João Luís Silva
2010-08-10 21:33:57 UTC
Hello,
I've recently found pyublas and it's being most useful to link python
and C++. However I've found a problem that doesn't make sense to me. I
can pass a non-square matrix from Python to C++, but when the matrix is
square I'll get the error:
Boost.Python.ArgumentError: Python argument types in
numerical_method.cpp_function(matrix)
did not match C++ signature:
cpp_function(pyublas::numpy_matrix<std::complex<double>,
boost::numeric::ublas::basic_row_major<unsigned int, int> >)
In the C++ side I have:
void cpp_function(pyublas::numpy_matrix<std::complex<double>> M)
and in Python:
numerical_method.cpp_function(np.asmatrix(self.M))
The same square matrix that won't work will work fine if reshaped to a
non-square shape. I've looked in the Ublas and pyUblas documentation but
couldn't find a specific type for square matrices.
Regards,
Jo?o Silva
I've recently found pyublas and it's being most useful to link python
and C++. However I've found a problem that doesn't make sense to me. I
can pass a non-square matrix from Python to C++, but when the matrix is
square I'll get the error:
Boost.Python.ArgumentError: Python argument types in
numerical_method.cpp_function(matrix)
did not match C++ signature:
cpp_function(pyublas::numpy_matrix<std::complex<double>,
boost::numeric::ublas::basic_row_major<unsigned int, int> >)
In the C++ side I have:
void cpp_function(pyublas::numpy_matrix<std::complex<double>> M)
and in Python:
numerical_method.cpp_function(np.asmatrix(self.M))
The same square matrix that won't work will work fine if reshaped to a
non-square shape. I've looked in the Ublas and pyUblas documentation but
couldn't find a specific type for square matrices.
Regards,
Jo?o Silva