Pauli Virtanen
2014-03-18 22:56:36 UTC
Hi,
Here are the fused types + memoryview signature resolution failures I
promised earlier (Cython 0.20.1):
(A)
TypeError: No matching signature
----------------------------- asd.pyx
cimport numpy as cnp
ctypedef fused value_t:
cnp.float32_t
cnp.float64_t
cpdef foo(value_t x):
pass
----------------------------- quux.py
import numpy as np
import asd
asd.foo(np.float32(1.0))
-----------------------------
(B)
ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'double'
----------------------------- asd.pyx
cimport numpy as cnp
ctypedef fused idx_t:
cnp.int32_t
cnp.int64_t
ctypedef fused value_t:
cnp.int64_t
cnp.float64_t
cpdef foo(idx_t[:,:] i, idx_t[:,:] j, value_t[:,:] x):
pass
----------------------------- quux.py
import numpy as np
import asd
i = np.zeros((3, 3), np.int64)
j = np.zeros((3, 3), np.int64)
x = np.zeros((3, 3), np.float64)
asd.foo(i, j, x)
-----------------------------
(C)
Then some nasty platform-dependent failures:
https://github.com/scipy/scipy/issues/3461
The relevant code is:
https://github.com/scipy/scipy/blob/master/scipy/sparse/_csparsetools.pyx#L202
The code looks nothing special. However, call to `lil_fancy_get` fails
with "TypeError: No matching signature found" when the inputs have types
<class 'int'> <class 'int'> <class 'numpy.ndarray'>
<class 'numpy.ndarray'> <class 'numpy.ndarray'> <class 'numpy.ndarray'>
<class 'numpy.ndarray'> <class 'numpy.ndarray'>
with ndarray dtypes: object object object object int32 int32
The failure occurs only on Christoph Gohlke's Win64 build, but not on
Linux/OSX/MINGW32. This sounds like some integer size combination
issue, but I'm far from sure.
Unfortunately, I'm not easily able to isolate/understand what's going
wrong here.
Here are the fused types + memoryview signature resolution failures I
promised earlier (Cython 0.20.1):
(A)
TypeError: No matching signature
----------------------------- asd.pyx
cimport numpy as cnp
ctypedef fused value_t:
cnp.float32_t
cnp.float64_t
cpdef foo(value_t x):
pass
----------------------------- quux.py
import numpy as np
import asd
asd.foo(np.float32(1.0))
-----------------------------
(B)
ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'double'
----------------------------- asd.pyx
cimport numpy as cnp
ctypedef fused idx_t:
cnp.int32_t
cnp.int64_t
ctypedef fused value_t:
cnp.int64_t
cnp.float64_t
cpdef foo(idx_t[:,:] i, idx_t[:,:] j, value_t[:,:] x):
pass
----------------------------- quux.py
import numpy as np
import asd
i = np.zeros((3, 3), np.int64)
j = np.zeros((3, 3), np.int64)
x = np.zeros((3, 3), np.float64)
asd.foo(i, j, x)
-----------------------------
(C)
Then some nasty platform-dependent failures:
https://github.com/scipy/scipy/issues/3461
The relevant code is:
https://github.com/scipy/scipy/blob/master/scipy/sparse/_csparsetools.pyx#L202
The code looks nothing special. However, call to `lil_fancy_get` fails
with "TypeError: No matching signature found" when the inputs have types
<class 'int'> <class 'int'> <class 'numpy.ndarray'>
<class 'numpy.ndarray'> <class 'numpy.ndarray'> <class 'numpy.ndarray'>
<class 'numpy.ndarray'> <class 'numpy.ndarray'>
with ndarray dtypes: object object object object int32 int32
The failure occurs only on Christoph Gohlke's Win64 build, but not on
Linux/OSX/MINGW32. This sounds like some integer size combination
issue, but I'm far from sure.
Unfortunately, I'm not easily able to isolate/understand what's going
wrong here.
--
Pauli Virtane
Pauli Virtane