Discussion:
[Pyublas] trouble with unsigned char
Garth Coghlan
2009-05-05 01:59:47 UTC
Permalink
Hi,

I've been wrapping some code with PyUblas, and appreciating its
usefulness. Today, though, I have discovered that I cannot successfully
pass a numpy array with dtype='uint8' through to a C++ function with a
numpy_matrix<unsigned char> argument. It complains that the signatures
don't match. The same also happens with char/int8. I can do int32s and
floats fine.

Possibly not related, but I noticed that in numpy.hpp the following line
was commented out:
inline NPY_TYPES get_typenum(npy_ubyte) { return NPY_UBYTE; }

So I uncommented that and commented the bool line instead. But that
hasn't helped.

Any ideas?

Thanks,
Garth


--
Garth Coghlan
2009-05-05 05:51:55 UTC
Permalink
Solved. For some reason there was no
expose_converters<npy_ubyte>();
in my pyublas_expose_converters() ...

Garth
Post by Garth Coghlan
Hi,
I've been wrapping some code with PyUblas, and appreciating its
usefulness. Today, though, I have discovered that I cannot
successfully pass a numpy array with dtype='uint8' through to a C++
function with a numpy_matrix<unsigned char> argument. It complains
that the signatures don't match. The same also happens with
char/int8. I can do int32s and floats fine.
Possibly not related, but I noticed that in numpy.hpp the following
inline NPY_TYPES get_typenum(npy_ubyte) { return NPY_UBYTE; }
So I uncommented that and commented the bool line instead. But that
hasn't helped.
Any ideas?
Thanks,
Garth
--
Andreas Klöckner
2009-05-05 14:26:49 UTC
Permalink
Post by Garth Coghlan
Solved. For some reason there was no
expose_converters<npy_ubyte>();
in my pyublas_expose_converters() ...
Thanks, fixed in git. I've also changed to-Python conversion to go take uint8
to uint8, as well as *permitting* Python bools to be converted to C++ [u]int8.
(Before, uint8 would *only* convert from bool, which seemed dumb.)

Thanks for reporting this.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.tiker.net/pipermail/pyublas/attachments/20090505/9fde5d91/attachment.pgp>
Loading...