Julien-Charles Lévesque
2012-03-14 22:09:39 UTC
Hi,
I have the following simple test, in which I believe everything should be
running fine :
cpp file (main.cpp):
#include <string>
folder simple_mod. It is then called by the following python script
(simple_example.py)
import numpy as np
linux without any errors. Do you have any idea what might be going wrong?
Thanks in advance,
Julien-Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tiker.net/pipermail/pyublas/attachments/20120314/525e02bf/attachment.html>
I have the following simple test, in which I believe everything should be
running fine :
cpp file (main.cpp):
#include <string>
#include <boost/python.hpp>
#include <pyublas/numpy.hpp>
using namespace boost::python;
using namespace pyublas;
void as_param(numpy_vector<int> input)
{
const npy_intp* dims = input.dims();
printf("dims_0: %i, dims_1: %i", dims[0], dims[1]);
return;
}
BOOST_PYTHON_MODULE(simple_mod)
{
def("as_a_parameter", as_param);
}
This cpp file is built as a dll, called simple_mod.pyd and put in the#include <pyublas/numpy.hpp>
using namespace boost::python;
using namespace pyublas;
void as_param(numpy_vector<int> input)
{
const npy_intp* dims = input.dims();
printf("dims_0: %i, dims_1: %i", dims[0], dims[1]);
return;
}
BOOST_PYTHON_MODULE(simple_mod)
{
def("as_a_parameter", as_param);
}
folder simple_mod. It is then called by the following python script
(simple_example.py)
import numpy as np
import simple_mod.simple_mod as sm
import pyublas
pyublas.set_trace(True)
x = np.array(5)
pyublas.why_not(x,dtype=int)
sm.as_a_parameter(x)
python simple_example.py
File "simple_example.py", line 12, in <module>
sm.as_a_parameter(x)
Boost.Python.ArgumentError: Python argument types in
simple_mod.simple_mod.as_a_parameter(numpy.ndarray)
as_a_parameter(class pyublas::numpy_vector<int>)
I have looked at numerous examples and have even used similar code underimport pyublas
pyublas.set_trace(True)
x = np.array(5)
pyublas.why_not(x,dtype=int)
sm.as_a_parameter(x)
python simple_example.py
File "simple_example.py", line 12, in <module>
sm.as_a_parameter(x)
Boost.Python.ArgumentError: Python argument types in
simple_mod.simple_mod.as_a_parameter(numpy.ndarray)
as_a_parameter(class pyublas::numpy_vector<int>)
linux without any errors. Do you have any idea what might be going wrong?
Thanks in advance,
Julien-Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tiker.net/pipermail/pyublas/attachments/20120314/525e02bf/attachment.html>