Andrew Wagner
2010-01-25 02:03:51 UTC
Hello-
I'm trying out pyublas for the first time, and am very excited about
it. Thanks again for all your hard work Andreas!
I'm having trouble running the doubleify example that is on the
website, in the test subdirectory of the pyublas source.
_____________
Here's the (unmodified) code:
$ cat sample_ext.cpp
#include <pyublas/numpy.hpp>
pyublas::numpy_vector<double> doublify(pyublas::numpy_vector<double> x)
{
return 2*x;
}
BOOST_PYTHON_MODULE(sample_ext)
{
boost::python::def("doublify", doublify);
}
_______________
Here's how I'm trying to call it from python:
$ cat sample.py
import numpy
import sample_ext
import pyublas # not explicitly used--but makes converters available
vec = numpy.ones((5,), dtype=float)
print vec
print sample_ext.doublify(vec)
________________
Here's how I'm building:
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
LINK_LIBRARIES(boost_python)
INCLUDE_DIRECTORIES("/usr/include/python2.5")
INCLUDE_DIRECTORIES("/usr/local/include")
LINK_DIRECTORIES("/usr/lib/python2.5")
ADD_LIBRARY(sample_ext SHARED sample_ext.cpp)
SET_TARGET_PROPERTIES(sample_ext PROPERTIES PREFIX "")
(The build finishes cleanly)
__________________
Here's the error I get:
$ python sample.py
[ 1. 1. 1. 1. 1.]
Traceback (most recent call last):
File "sample.py", line 7, in <module>
print sample_ext.doublify(vec)
Boost.Python.ArgumentError: Python argument types in
sample_ext.doublify(numpy.ndarray)
did not match C++ signature:
doublify(pyublas::numpy_vector<double>)
__________________
Here's my ~/.aksetup-defaults.py:
BOOST_BINDINGS_INC_DIR = ['/usr/local/include/pyublas']
BOOST_INC_DIR = ['/usr/include/boost-1_35']
BOOST_LIB_DIR = ['/usr/lib']
BOOST_PYTHON_LIBNAME = ['boost_python-gcc42-mt-1_35-py25']
__________________
As far as I can tell, every thing up to that went cleanly. Any
suggestions? I'm using Debian, x86-64, and boost 1.35 that's in apt.
The pyublas was pulled from the git repository today.
Thanks!
Drew
I'm trying out pyublas for the first time, and am very excited about
it. Thanks again for all your hard work Andreas!
I'm having trouble running the doubleify example that is on the
website, in the test subdirectory of the pyublas source.
_____________
Here's the (unmodified) code:
$ cat sample_ext.cpp
#include <pyublas/numpy.hpp>
pyublas::numpy_vector<double> doublify(pyublas::numpy_vector<double> x)
{
return 2*x;
}
BOOST_PYTHON_MODULE(sample_ext)
{
boost::python::def("doublify", doublify);
}
_______________
Here's how I'm trying to call it from python:
$ cat sample.py
import numpy
import sample_ext
import pyublas # not explicitly used--but makes converters available
vec = numpy.ones((5,), dtype=float)
print vec
print sample_ext.doublify(vec)
________________
Here's how I'm building:
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
LINK_LIBRARIES(boost_python)
INCLUDE_DIRECTORIES("/usr/include/python2.5")
INCLUDE_DIRECTORIES("/usr/local/include")
LINK_DIRECTORIES("/usr/lib/python2.5")
ADD_LIBRARY(sample_ext SHARED sample_ext.cpp)
SET_TARGET_PROPERTIES(sample_ext PROPERTIES PREFIX "")
(The build finishes cleanly)
__________________
Here's the error I get:
$ python sample.py
[ 1. 1. 1. 1. 1.]
Traceback (most recent call last):
File "sample.py", line 7, in <module>
print sample_ext.doublify(vec)
Boost.Python.ArgumentError: Python argument types in
sample_ext.doublify(numpy.ndarray)
did not match C++ signature:
doublify(pyublas::numpy_vector<double>)
__________________
Here's my ~/.aksetup-defaults.py:
BOOST_BINDINGS_INC_DIR = ['/usr/local/include/pyublas']
BOOST_INC_DIR = ['/usr/include/boost-1_35']
BOOST_LIB_DIR = ['/usr/lib']
BOOST_PYTHON_LIBNAME = ['boost_python-gcc42-mt-1_35-py25']
__________________
As far as I can tell, every thing up to that went cleanly. Any
suggestions? I'm using Debian, x86-64, and boost 1.35 that's in apt.
The pyublas was pulled from the git repository today.
Thanks!
Drew