{"action":"created","issue":{"url":"https://api.github.com/repos/serge-sans-paille/pythran/issues/594","repository_url":"https://api.github.com/repos/serge-sans-paille/pythran","labels_url":"https://api.github.com/repos/serge-sans-paille/pythran/issues/594/labels{/name}","comments_url":"https://api.github.com/repos/serge-sans-paille/pythran/issues/594/comments","events_url":"https://api.github.com/repos/serge-sans-paille/pythran/issues/594/events","html_url":"https://github.com/serge-sans-paille/pythran/issues/594","id":166831635,"number":594,"title":"conversion failed","user":{"login":"nbecker","id":117456,"avatar_url":"https://avatars.githubusercontent.com/u/117456?v=3","gravatar_id":"","url":"https://api.github.com/users/nbecker","html_url":"https://github.com/nbecker","followers_url":"https://api.github.com/users/nbecker/followers","following_url":"https://api.github.com/users/nbecker/following{/other_user}","gists_url":"https://api.github.com/users/nbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/nbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbecker/subscriptions","organizations_url":"https://api.github.com/users/nbecker/orgs","repos_url":"https://api.github.com/users/nbecker/repos","events_url":"https://api.github.com/users/nbecker/events{/privacy}","received_events_url":"https://api.github.com/users/nbecker/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-07-21T14:22:16Z","updated_at":"2016-07-22T14:17:10Z","closed_at":"2016-07-22T12:08:01Z","body":"Did the type of z get inferred to be ndarray<std::complex<double>>, where it should have been \r\nstd::complex<double>?\r\n\r\n``\r\n pythran lms_1st_multi2.py\r\n/tmp/tmpg5pi9573.cpp: In instantiation of ‘typename __pythran_lms_1st_multi2::lms_1st_multi::type<argument_type0, argument_type1, argument_type2, argument_type3, argument_type4>::result_type __pythran_lms_1st_multi2::lms_1st_multi::operator()(argument_type0&&, const argument_type1&, const argument_type2&, const argument_type3&, const argument_type4&) const [with argument_type0 = pythonic::types::ndarray<std::complex<double>, 2ul>&; argument_type1 = pythonic::types::ndarray<std::complex<double>, 1ul>; argument_type2 = pythonic::types::ndarray<std::complex<double>, 2ul>; argument_type3 = pythonic::types::ndarray<double, 1ul>; argument_type4 = long int; typename __pythran_lms_1st_multi2::lms_1st_multi::type<argument_type0, argument_type1, argument_type2, argument_type3, argument_type4>::result_type = pythonic::types::ndarray<std::complex<double>, 1ul>]’:\r\n/tmp/tmpg5pi9573.cpp:233:70:   required from here\r\n/tmp/tmpg5pi9573.cpp:162:101: error: conversion from ‘pythonic::types::type_helper<const pythonic::types::ndarray<std::complex<double>, 1ul>&>::type {aka std::complex<double>}’ to non-scalar type ‘pythonic::assignable<pythonic::types::numpy_expr<pythonic::operator_::functor::add, pythonic::types::broadcast<std::complex<double>, std::complex<double> >, pythonic::types::ndarray<std::complex<double>, 1ul> > >::type {aka pythonic::types::ndarray<std::complex<double>, 1ul>}’ requested\r\n           typename pythonic::assignable<typename __combined<__type24,__type43>::type>::type z = y1[i];\r\n                                                                                                     ^\r\n``\r\n\r\n``\r\nimport numpy as np\r\n\r\n#pythran export lms_1st_multi (complex[:,:], complex[:], complex[:,:], float[:], int)\r\ndef lms_1st_multi (alphas, y1, inputs, ks, chunksize):\r\n    L = y1.shape[0]\r\n    M = alphas.shape[1]\r\n    n_inputs = inputs.shape[0]\r\n    zout = np.empty (L-M, dtype=complex)\r\n    errs = np.empty ((n_inputs, M), dtype=complex)\r\n    #errs[nd::view()()] = 0\r\n\r\n    for i in range (M/2, L-M/2-1+1):\r\n        z = y1[i]\r\n        for inp in range (n_inputs):\r\n            z -= np.dot (alphas[inp,:], inputs[inp, i-M/2,i+M/2+1])\r\n\r\n        for inp in range (n_inputs):\r\n            for j in range (M):\r\n                w = inputs[inp,i-M/2+j]\r\n                errs[inp,j] += z * w.conjugate()\r\n\r\n        if i % chunksize == chunksize - 1:\r\n            try:\r\n                k = ks[i/chunksize]\r\n            except:\r\n                k = ks\r\n\r\n            for inp in range (n_inputs):\r\n                for j in range (M):\r\n                    alphas[inp,j] += errs[inp,j] * k\r\n                errs[inp,j] = 0\r\n\r\n        zout[i-M/2] = z\r\n\r\n\r\n    return zout\r\n\r\n``\r\n"},"comment":{"url":"https://api.github.com/repos/serge-sans-paille/pythran/issues/comments/234555772","html_url":"https://github.com/serge-sans-paille/pythran/issues/594#issuecomment-234555772","issue_url":"https://api.github.com/repos/serge-sans-paille/pythran/issues/594","id":234555772,"user":{"login":"serge-sans-paille","id":863807,"avatar_url":"https://avatars.githubusercontent.com/u/863807?v=3","gravatar_id":"","url":"https://api.github.com/users/serge-sans-paille","html_url":"https://github.com/serge-sans-paille","followers_url":"https://api.github.com/users/serge-sans-paille/followers","following_url":"https://api.github.com/users/serge-sans-paille/following{/other_user}","gists_url":"https://api.github.com/users/serge-sans-paille/gists{/gist_id}","starred_url":"https://api.github.com/users/serge-sans-paille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serge-sans-paille/subscriptions","organizations_url":"https://api.github.com/users/serge-sans-paille/orgs","repos_url":"https://api.github.com/users/serge-sans-paille/repos","events_url":"https://api.github.com/users/serge-sans-paille/events{/privacy}","received_events_url":"https://api.github.com/users/serge-sans-paille/received_events","type":"User","site_admin":false},"created_at":"2016-07-22T14:17:10Z","updated_at":"2016-07-22T14:17:10Z","body":"On Fri, Jul 22, 2016 at 05:08:01AM -0700, ndbecker wrote:\n> Yes, sorry - there was a typo.  Should say inputs[inp, i-M//2:i+M//2+1]\n\nThen the following is the best i can do in current pythran state:\n\n\n    #pythran export lms_1st_multi_0 (complex[:,:], complex[:], complex[:,:], float[:], int)\n    #pythran export lms_1st_multi_1 (complex[:,:], complex[:], complex[:,:], float, int)\n    import numpy as np\n\n    def lms_1st_multi_0 (alphas, y1, inputs, ks, chunksize):\n        return  _lms_1st_multi (alphas, y1, inputs, ks, chunksize, lambda x, y: x[y])\n\n    def lms_1st_multi_1 (alphas, y1, inputs, ks, chunksize):\n        return  _lms_1st_multi (alphas, y1, inputs, ks, chunksize, lambda x, y: x)\n\n    def _lms_1st_multi (alphas, y1, inputs, ks, chunksize, access):\n        L = y1.shape[0]\n        M = alphas.shape[1]\n        n_inputs = inputs.shape[0]\n        zout = np.empty (L-M, dtype=complex)\n        errs = np.empty ((n_inputs, M), dtype=complex)\n\n        for i in range (M/2, L-M/2-1+1):\n            z = y1[i]\n            for inp in range (n_inputs):\n                z -= np.dot (alphas[inp,:], inputs[inp, i-M/2:i+M/2+1])\n\n            for inp in range (n_inputs):\n                for j in range (M):\n                    w = inputs[inp,i-M/2+j]\n                    errs[inp,j] += z * w.conjugate()\n\n            if i % chunksize == chunksize - 1:\n                k = access(ks, i/chunksize)\n\n                for inp in range (n_inputs):\n                    for j in range (M):\n                        alphas[inp,j] += errs[inp,j] * k\n                    errs[inp,j] = 0\n\n            zout[i-M/2] = z\n\n\n        return zout\n\n:-/\n"}}
{"actor":{"display_login":"serge-sans-paille"}}