[Pyublas] did not match C++ signature for pyublas::numpy_vector<float>

Andreas Kloeckner lists at informa.tiker.net
Mon Feb 14 09:05:53 PST 2011


Hi Jeff,

On Mon, 14 Feb 2011 09:43:22 -0700, Jeff Mast <jeff.mast at mastfamily.com> wrote:
> I am having trouble using float arrays with pyublas and am getting "did 
> not match C++ signature" at runtime when I change
> pyublas::numpy_vector<double> to pyublas::numpy_vector<float>
> 
> Seems like this should just work, but I have no idea what is going wrong.
> 
> Compile line:
> 
> gcc -I/usr/include/python2.6 -fPIC -g -fpic -shared 
> -Wl,-soname,sample_ext.so sample_ext.cpp -lboost_python-mt-py26 
> -lpython2.6 -o sample_ext.so
> 
> pyublas from tip of git repository 
> (46d422f55d4a38282d8eecfb3c59e6ac13712f6e)
> ubuntu 10.10
> gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
> boost 4.2
> python2.6
> 
> ldd sample_ext.so
>          linux-vdso.so.1 =>  (0x00007fffa15ff000)
>          libboost_python-py26.so.1.42.0 => 
> /usr/lib/libboost_python-py26.so.1.42.0 (0x00007fd062879000)
>          libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 
> (0x00007fd0623ca000)
>          libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fd0621b3000)
>          libc.so.6 => /lib/libc.so.6 (0x00007fd061e30000)
>          libutil.so.1 => /lib/libutil.so.1 (0x00007fd061c2d000)
>          libpthread.so.0 => /lib/libpthread.so.0 (0x00007fd061a0f000)
>          libdl.so.2 => /lib/libdl.so.2 (0x00007fd06180b000)
>          librt.so.1 => /lib/librt.so.1 (0x00007fd061603000)
>          libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fd0612fc000)
>          libm.so.6 => /lib/libm.so.6 (0x00007fd061079000)
>          libssl.so.0.9.8 => /lib/libssl.so.0.9.8 (0x00007fd060e27000)
>          libcrypto.so.0.9.8 => /lib/libcrypto.so.0.9.8 (0x00007fd060a9a000)
>          libz.so.1 => /lib/libz.so.1 (0x00007fd060882000)
>          /lib64/ld-linux-x86-64.so.2 (0x00007fd062d0a000)
> 
> 
> modified sample_ext.cpp:
> 
> #include <pyublas/numpy.hpp>
> 
> pyublas::numpy_vector<float> doublify(pyublas::numpy_vector<float> x)
> {
>    return 2*x;
> }
> 
> BOOST_PYTHON_MODULE(sample_ext)
> {
>    boost::python::def("doublify", doublify);
> }

Sample.py passed numpy.float values, which correspond to double in
C++. To make this work, you need to pass float32. I've thought about
allowing copy+conversion in PyUblas by some means, but for now PyUblas
only allows you to do the efficient thing.

HTH,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pyublas/attachments/20110214/131c4319/attachment.pgp>


More information about the Pyublas mailing list