Code Monkey home page Code Monkey logo

Comments (4)

kyamagu avatar kyamagu commented on May 29, 2024 1

@patrikhuber I am not familiar with Eigen library, but my bet is that Eigen::MatrixXd itself is a template and that might be treating Eigen::MatrixXd as a container just like a std::vector. The exact check is happening here

For a quick workaround for this issue, you can specialize std::vector<Eigen::MatrixXd>.

To make conversion more efficient, you can instantiate numeric matrix first and use std::copy or ANSI C memcpy to copy data, assuming everything is column-major order.
https://github.com/patrikhuber/eos/blob/7f0e46179112c44c26321491ea0246394a9a5a8a/matlab/include/mexplus_eigen.hpp#L48

from mexplus.

kyamagu avatar kyamagu commented on May 29, 2024 1

@patrikhuber For now, I recommend std::vector<Eigen::MatrixXd> specialization. The desired solution is a fix for a better template support (c.f., #25 ), but that requires major API updates.

from mexplus.

patrikhuber avatar patrikhuber commented on May 29, 2024

I am not familiar with Eigen library, but my bet is that Eigen::MatrixXd itself is a template and that might be treating Eigen::MatrixXd as a container just like a std::vector. The exact check is happening here

Yes, it is a template indeed. Aah! So the check, if I understand correctly, thinks that Eigen::MatrixXd is a std::vector, because it has a first template parameter (and it's a double), so the check here fires:

template <typename T>
struct MxArithmeticCompound<T, typename std::enable_if<
(MxArithmeticType<typename T::value_type>::value) &&

And then obviously it fails because it tries to call std::vector::assign(...).
Is that correct?

Do you think we could do a better solution than the "specialise std::vectorEigen::MatrixXd" workaround?

from mexplus.

patrikhuber avatar patrikhuber commented on May 29, 2024

@kyamagu Ok, I will! I'll close this then in favour of #25.
Thank you very much for the quick replies! :-)

from mexplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.