We have answer of your question!

100% solved queries, no empty question

Question: Eigen no matching function for call .dot()?



In my code I define a template class with an operator() that is defined as follows:

template<class Integrator, int ORDER>
inline double operator() (FiniteElement<Integrator, ORDER,2,3>& currentfe_,
                          int i, int j, int iq, int ic = 0)
    Real s = 0;

    Eigen::Matrix<double,2,1> grad_phi_i;
    Eigen::Matrix<double,2,1> grad_phi_j;

    grad_phi_i(0) = ...
    grad_phi_i(1) = ...
    grad_phi_j(0) = ...
    grad_phi_j(1) = ...

    s = grad_phi_i.dot(currentfe_.metric().dot(grad_phi_j));

    return s;



Is a method of class FiniteElement returning a Eigen::Matrix<double,2,2>.

The error i get is:

error: no matching function for call to ‘Eigen::Matrix<double, 2, 1>::dot(Eigen::internal::scalar_product_traits<double, double>::ReturnType)’
s = grad_phi_i.dot(currentfe_.metric().dot(grad_phi_j));

And I cannot figure out why.

Question author Mariob | Source




This is because the Matrix .dot() method is only for the scalar product between vectors (see the documentation). Here you can see that the multiplication between a matrix and a vector is performed with *.

A possible solution is:

Answer author Nickerx


Tickanswer.com is providing the only single recommended solution of the question Eigen no matching function for call .dot()? under the categories i.e c++ , methods , eigen3 , . Our team of experts filter the best solution for you.

Related Search Queries:

You may also add your answer!