This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen::MatrixXd.fullPivLu().solve

Tags: None
(comma "," separated)
kevintew
Registered Member
Posts
1
Karma
0

Eigen::MatrixXd.fullPivLu().solve

Wed Mar 12, 2014 10:55 pm
The following code generates compiler errors.

Eigen::MatrixXd kp(rows, rows);
Matrix< PointType, Eigen::Dynamic, 1> sol_mat(rows, 1);
Matrix< PointType, Eigen::Dynamic, 1> rhs_mat(rows, 1);
...
sol_mat = kp.fullPivLu().solve( rhs_mat );


Essentially operator-= isn't defined on Matricies for my type PointType, which is a point that behaves like a scalar.
I assume /home/tewk/research/codes/util/Eigen/src/Core/products/TriangularSolverVector.h:117 works for Matrix< double, Eigen::Dynamic, 1>, so I 'm curious where the -=overload for double is and how I can specify a -=overload for my type.



Compiler Error:
36 /home/tewk/research/codes/util/Eigen/src/Core/products/TriangularSolverVector.h:117 col 54: error: no match for ‘operator-=’ (operand types are ‘Eigen::Map<Eigen::Matrix<util::Point<3u, double, true>, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >’ and ‘util::Point<3u, double, true>’)
39 /home/tewk/research/codes/util/Eigen/src/Core/products/TriangularSolverVector.h:117 col 54: note: candidates are:
40 /home/tewk/research/codes/util/Eigen/src/Core/CwiseBinaryOp.h:206 col 1: note: template<class OtherDerived> Derived& Eigen::MatrixBase<Derived>::operator-=(const Eigen::MatrixBase
<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::Map<Eigen::Matrix<util::Point<3u, double, true>, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >]
43 /home/tewk/research/codes/util/Eigen/src/Core/CwiseBinaryOp.h:206 col 1: note: template argument deduction/substitution failed:
44 /home/tewk/research/codes/util/Eigen/src/Core/products/TriangularSolverVector.h:117 col 54: note: ‘util::Point<3u, double, true>’ is not derived from ‘const Eigen::MatrixBase<Derived>’
47 /home/tewk/research/codes/util/Eigen/src/Core/MatrixBase.h:505 col 46: note: template<class OtherDerived> Derived& Eigen::MatrixBase<Derived>::operator-=(const Eigen::ArrayBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::Map<Eigen::Matrix<util::Point<3u, double, true>, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >]
50 /home/tewk/research/codes/util/Eigen/src/Core/MatrixBase.h:505 col 46: note: template argument deduction/substitution failed:
51 /home/tewk/research/codes/util/Eigen/src/Core/products/TriangularSolverVector.h:117 col 54: note: ‘util::Point<3u, double, true>’ is not derived from ‘const Eigen::ArrayBase<Derived>’
54 /home/tewk/research/codes/util/Eigen/src/Core/DenseBase.h:254 col 14: note: template<class OtherDerived> Derived& Eigen::DenseBase<Derived>::operator-=(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::Map<Eigen::Matrix<util::Point<3u, double, true>, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >]
57 /home/tewk/research/codes/util/Eigen/src/Core/DenseBase.h:254 col 14: note: template argument deduction/substitution failed:
58 /home/tewk/research/codes/util/Eigen/src/Core/products/TriangularSolverVector.h:117 col 54: note: ‘util::Point<3u, double, true>’ is not derived from ‘const Eigen::EigenBase<Derived>’
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
I don't think that's the problem. However, to enable mixing types you have to specialize:
Code: Select all
template<> struct scalar_product_traits<double,PointType>
{
  enum {  Defined = 1  };
  typedef PointType ReturnType;
};


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]