Re: [Numpy-discussion] npymath on Windows

2014-12-29 Thread Matthew Brett
Hi,

On Sun, Dec 28, 2014 at 4:17 PM, David Cournapeau courn...@gmail.com wrote:


 On Sun, Dec 28, 2014 at 1:59 AM, Matthew Brett matthew.br...@gmail.com
 wrote:

 Hi,

 Sorry for this ignorant email, but we got confused trying to use
 'libnpymath.a' from the mingw builds of numpy:

 We were trying to link against the mingw numpy 'libnpymath.a' using
 Visual Studio C, but this give undefined symbols from 'libnpymath.a'
 like this:


 This is not really supported. You should avoid mixing compilers when
 building C extensions using numpy C API. Either all mingw, or all MSVC.

It would be very useful to support MSVC compilation from our standard binaries.

We (nipy / dipy) have had to remove our dependence on the npymath
library because - at the moment - the naive user may find themselves
trying to compile the package with visual C when they have the
standard numpy windows package, and this will fail for them.

How about shipping an MSVC-compiled npymath.lib with the mingw compiled package?

Cheers,

Matthew
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Access dtype kind from cython

2014-12-29 Thread Valentin Haenel
Hi,

how do I access the kind of the data from cython, i.e. the single
character string:

'b' boolean
'i' (signed) integer
'u' unsigned integer
'f' floating-point
'c' complex-floating point
'O' (Python) objects
'S', 'a' (byte-)string
'U' Unicode
'V' raw data (void)

In regular Python I can do:

In [7]: d = np.dtype('S')

In [8]: d.kind
Out[8]: 'S'

Looking at the definition of dtype that comes with cython, I see:

  ctypedef class numpy.dtype [object PyArray_Descr]:
  # Use PyDataType_* macros when possible, however there are no macros
  # for accessing some of the fields, so some are defined. Please
  # ask on cython-dev if you need more.
  cdef int type_num
  cdef int itemsize elsize
  cdef char byteorder
  cdef object fields
  cdef tuple names

I.e. no kind.

Also, i looked for an appropriate PyDataType_* macro but couldn't find one.

Perhaps there is something simple I could use?

best,

V-
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Access dtype kind from cython

2014-12-29 Thread Eric Moore
On Monday, December 29, 2014, Valentin Haenel valen...@haenel.co wrote:

 Hi,

 how do I access the kind of the data from cython, i.e. the single
 character string:

 'b' boolean
 'i' (signed) integer
 'u' unsigned integer
 'f' floating-point
 'c' complex-floating point
 'O' (Python) objects
 'S', 'a' (byte-)string
 'U' Unicode
 'V' raw data (void)

 In regular Python I can do:

 In [7]: d = np.dtype('S')

 In [8]: d.kind
 Out[8]: 'S'

 Looking at the definition of dtype that comes with cython, I see:

   ctypedef class numpy.dtype [object PyArray_Descr]:
   # Use PyDataType_* macros when possible, however there are no macros
   # for accessing some of the fields, so some are defined. Please
   # ask on cython-dev if you need more.
   cdef int type_num
   cdef int itemsize elsize
   cdef char byteorder
   cdef object fields
   cdef tuple names

 I.e. no kind.

 Also, i looked for an appropriate PyDataType_* macro but couldn't find one.

 Perhaps there is something simple I could use?

 best,

 V-
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org javascript:;
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

From C or cython I'd just use the typenum. Compare against the appropriate
macros, NPY_DOUBLE e.g.

Eric
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion