Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy_eigen conversion to eigen is not working correctly #176

Open
fmina opened this issue Feb 14, 2017 · 0 comments · May be fixed by #177
Open

numpy_eigen conversion to eigen is not working correctly #176

fmina opened this issue Feb 14, 2017 · 0 comments · May be fixed by #177

Comments

@fmina
Copy link

fmina commented Feb 14, 2017

If I create an eigen matrix and convert it to python object, and pass it to python function as follows

Eigen::Matrix<double, 2, 2> input;
input << 1,2,3,4;
boost::python::object PYinput(input);
boost::python::object PYoutput = my_module.attr("get_numpy_array")(PYinput);

get_numpy_array is simply returning the same matrix.

def get_numpy_array(X):
    print X #this is working ok.
    return X

Now, if I try to convert the return python object to Eigen matrix again

Eigen::Matrix<double, 2, 2> output = boost::python::extract<Eigen::Matrix<double, 2, 2>>(PYoutput);
 std::cout << output <<std::endl;

I get

4.94066e-324            1
6.95322e-310            3

I am running this on mac osx El Capitan, with python 2.7.13.

@HannesSommer @schneith any clue about this?

@fmina fmina linked a pull request Feb 14, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant