## I want to use Jacobi to get Eigenvalues and Eigenvectors

tedramsey
Registered Member
Posts
2
Karma
0

### I want to use Jacobi to get Eigenvalues and Eigenvectors

Sat Feb 02, 2013 11:38 pm
I have a feeling this is going to seem very newbie, so here goes. I have 2 questions, the first of which is pretty straightforward and is the more important of the two.

1. Looking at this tutorial getting eigenvalues it seems simple enough. It says to choose your eigendecomposition of which I chose Jacobi SVD

However when I visit that page it talks about returning the thinU and thinV matrices. I dont know much about the Jacobi method so I want to know is it possible to use the Jacobi SVD to return a matrix of eigen values and eigen vectors? Im confused by the example provided which doesnt seem to make any mention of this.

2. When I ran the example on that page I got loads of errors (I have not had this problem with other simpler examples with Eigen). Any idea what fundamental error is being made?

Code: Select all
`1>src\core\products\coeffbasedproduct.h(43): error C2027: use of undefined type 'Eigen::internal::scalar_product_traits<T,U>'1>          with1>          [1>              T=double,1>              U=float1>          ]1>          src\core\densebase.h(33) : see reference to class template instantiation 'Eigen::internal::traits<T>' being compiled1>          with1>          [1>              T=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>          src\core\matrixbase.h(50) : see reference to class template instantiation 'Eigen::DenseBase<Derived>' being compiled1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>          src\core\products\coeffbasedproduct.h(116) : see reference to class template instantiation 'Eigen::MatrixBase<Derived>' being compiled1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>          c:\users\cdechenu\dropbox\cqf\exams\project workings\c++\hjm model\eigen\eigen\src\svd\jacobisvd.h(846) : see reference to class template instantiation 'Eigen::CoeffBasedProduct<LhsNested,RhsNested,NestingFlags>' being compiled1>          with1>          [1>              LhsNested=const Eigen::Matrix<double,-1,-1> &,1>              RhsNested=const Eigen::Matrix<float,3,1> &,1>              NestingFlags=61>          ]1>          c:\users\cdechenu\dropbox\cqf\exams\project workings\c++\hjm model\eigen\eigen\src\misc\solve.h(51) : see reference to function template instantiation 'void Eigen::internal::solve_retval<DecompositionType,Rhs>::evalTo<Dest>(Dest &) const' being compiled1>          with1>          [1>              DecompositionType=Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,1>              Rhs=Eigen::Matrix<float,3,1>,1>              Dest=Eigen::Matrix<float,-1,1>1>          ]1>          src\core\returnbyvalue.h(60) : see reference to function template instantiation 'void Eigen::internal::solve_retval_base<_DecompositionType,Rhs>::evalTo<Dest>(Dest &) const' being compiled1>          with1>          [1>              _DecompositionType=Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,1>              Rhs=Eigen::Matrix<float,3,1>,1>              Dest=Eigen::Matrix<float,-1,1>1>          ]1>          src\core\matrix.h(296) : see reference to function template instantiation 'void Eigen::ReturnByValue<Derived>::evalTo<Eigen::Matrix<_Scalar,_Rows,_Cols>>(Dest &) const' being compiled1>          with1>          [1>              Derived=Eigen::internal::solve_retval_base<Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,Eigen::Matrix<float,3,1>>,1>              _Scalar=float,1>              _Rows=-1,1>              _Cols=1,1>              Dest=Eigen::Matrix<float,-1,1>1>          ]1>          src\core\densebase.h(377) : see reference to function template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols>::Matrix<Eigen::internal::solve_retval_base<_DecompositionType,Rhs>>(const Eigen::ReturnByValue<Derived> &)' being compiled1>          with1>          [1>              _Scalar=float,1>              _Rows=-1,1>              _Cols=1,1>              _DecompositionType=Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,1>              Rhs=Eigen::Matrix<float,3,1>,1>              Derived=Eigen::internal::solve_retval_base<Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,Eigen::Matrix<float,3,1>>1>          ]1>          src\core\densebase.h(373) : while compiling class template member function 'const Eigen::Matrix<_Scalar,_Rows,_Cols> Eigen::DenseBase<Derived>::eval(void) const'1>          with1>          [1>              _Scalar=float,1>              _Rows=-1,1>              _Cols=1,1>              Derived=Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,Eigen::Matrix<float,3,1>>>1>          ]1>          src\core\matrixbase.h(50) : see reference to class template instantiation 'Eigen::DenseBase<Derived>' being compiled1>          with1>          [1>              Derived=Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,Eigen::Matrix<float,3,1>>>1>          ]1>          src\core\returnbyvalue.h(52) : see reference to class template instantiation 'Eigen::MatrixBase<Derived>' being compiled1>          with1>          [1>              Derived=Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,Eigen::Matrix<float,3,1>>>1>          ]1>          c:\users\cdechenu\dropbox\cqf\exams\project workings\c++\hjm model\eigen\eigen\src\misc\solve.h(34) : see reference to class template instantiation 'Eigen::ReturnByValue<Derived>' being compiled1>          with1>          [1>              Derived=Eigen::internal::solve_retval_base<Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,Eigen::Matrix<float,3,1>>1>          ]1>          c:\users\cdechenu\dropbox\cqf\exams\project workings\c++\hjm model\eigen\eigen\src\svd\jacobisvd.h(825) : see reference to class template instantiation 'Eigen::internal::solve_retval_base<_DecompositionType,Rhs>' being compiled1>          with1>          [1>              _DecompositionType=Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,1>              Rhs=Eigen::Matrix<float,3,1>1>          ]1>          c:\users\cdechenu\dropbox\cqf\exams\project workings\c++\hjm model\hjm model\hjm.cpp(228) : see reference to class template instantiation 'Eigen::internal::solve_retval<DecompositionType,Rhs>' being compiled1>          with1>          [1>              DecompositionType=Eigen::JacobiSVD<Eigen::Matrix<double,-1,-1>>,1>              Rhs=Eigen::Matrix<float,3,1>1>          ]1>src\core\products\coeffbasedproduct.h(43): error C2146: syntax error : missing ';' before identifier 'Scalar'1>src\core\products\coeffbasedproduct.h(43): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>src\core\products\coeffbasedproduct.h(43): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>src\core\products\coeffbasedproduct.h(69): error C2065: 'Scalar' : undeclared identifier1>src\core\products\coeffbasedproduct.h(69): error C2955: 'Eigen::internal::packet_traits' : use of class template requires template argument list1>          src\core\genericpacketmath.h(71) : see declaration of 'Eigen::internal::packet_traits'1>src\core\products\coeffbasedproduct.h(76): error C2065: 'Scalar' : undeclared identifier1>src\core\products\coeffbasedproduct.h(76): error C2955: 'Eigen::internal::packet_traits' : use of class template requires template argument list1>          src\core\genericpacketmath.h(71) : see declaration of 'Eigen::internal::packet_traits'1>src\core\products\coeffbasedproduct.h(93): error C2065: 'Scalar' : undeclared identifier1>src\core\products\coeffbasedproduct.h(93): error C2955: 'Eigen::NumTraits' : use of class template requires template argument list1>          src\core\numtraits.h(88) : see declaration of 'Eigen::NumTraits'1>src\core\products\coeffbasedproduct.h(94): error C2065: 'Scalar' : undeclared identifier1>src\core\products\coeffbasedproduct.h(94): error C2955: 'Eigen::NumTraits' : use of class template requires template argument list1>          src\core\numtraits.h(88) : see declaration of 'Eigen::NumTraits'1>src\core\products\coeffbasedproduct.h(106): error C2065: 'Scalar' : undeclared identifier1>src\core\products\coeffbasedproduct.h(106): error C2955: 'Eigen::internal::packet_traits' : use of class template requires template argument list1>          src\core\genericpacketmath.h(71) : see declaration of 'Eigen::internal::packet_traits'1>src\core\densebase.h(33): error C2039: 'Scalar' : is not a member of 'Eigen::internal::traits<T>'1>          with1>          [1>              T=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(33): error C2146: syntax error : missing ',' before identifier 'Scalar'1>src\core\densebase.h(33): error C2065: 'Scalar' : undeclared identifier1>src\core\densebase.h(34): error C2039: 'Scalar' : is not a member of 'Eigen::internal::traits<T>'1>          with1>          [1>              T=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(34): error C2146: syntax error : missing ',' before identifier 'Scalar'1>src\core\densebase.h(34): error C2065: 'Scalar' : undeclared identifier1>src\core\densebase.h(34): error C2955: 'Eigen::NumTraits' : use of class template requires template argument list1>          src\core\numtraits.h(88) : see declaration of 'Eigen::NumTraits'1>src\core\densebase.h(38): error C2955: 'Eigen::internal::special_scalar_op_base' : use of class template requires template argument list1>          src\core\util\xprhelper.h(349) : see declaration of 'Eigen::internal::special_scalar_op_base'1>src\core\densebase.h(40): error C2039: 'Scalar' : is not a member of 'Eigen::internal::traits<T>'1>          with1>          [1>              T=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(40): error C2146: syntax error : missing ',' before identifier 'Scalar'1>src\core\densebase.h(40): error C2065: 'Scalar' : undeclared identifier1>src\core\densebase.h(41): error C2039: 'Scalar' : is not a member of 'Eigen::internal::traits<T>'1>          with1>          [1>              T=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(41): error C2146: syntax error : missing ',' before identifier 'Scalar'1>src\core\densebase.h(41): error C2065: 'Scalar' : undeclared identifier1>src\core\densebase.h(41): error C2955: 'Eigen::NumTraits' : use of class template requires template argument list1>          src\core\numtraits.h(88) : see declaration of 'Eigen::NumTraits'1>src\core\densebase.h(41): error C2955: 'Eigen::internal::special_scalar_op_base' : use of class template requires template argument list1>          src\core\util\xprhelper.h(349) : see declaration of 'Eigen::internal::special_scalar_op_base'1>src\core\densebase.h(53): error C2039: 'Scalar' : is not a member of 'Eigen::internal::traits<T>'1>          with1>          [1>              T=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(53): error C2146: syntax error : missing ';' before identifier 'Scalar'1>src\core\densebase.h(53): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>src\core\densebase.h(53): error C2602: 'Eigen::DenseBase<Derived>::Scalar' is not a member of a base class of 'Eigen::DenseBase<Derived>'1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>          src\core\densebase.h(53) : see declaration of 'Eigen::DenseBase<Derived>::Scalar'1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(53): error C2868: 'Eigen::DenseBase<Derived>::Scalar' : illegal syntax for using-declaration; expected qualified-name1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densecoeffsbase.h(39): error C2039: 'Scalar' : is not a member of 'Eigen::internal::traits<T>'1>          with1>          [1>              T=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>          src\core\densebase.h(58) : see reference to class template instantiation 'Eigen::DenseCoeffsBase<Derived>' being compiled1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densecoeffsbase.h(39): error C2146: syntax error : missing ';' before identifier 'Scalar'1>src\core\densecoeffsbase.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>src\core\densecoeffsbase.h(39): error C2602: 'Eigen::DenseCoeffsBase<Derived>::Scalar' is not a member of a base class of 'Eigen::DenseCoeffsBase<Derived>'1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>          src\core\densecoeffsbase.h(39) : see declaration of 'Eigen::DenseCoeffsBase<Derived>::Scalar'1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densecoeffsbase.h(39): error C2868: 'Eigen::DenseCoeffsBase<Derived>::Scalar' : illegal syntax for using-declaration; expected qualified-name1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(58): error C3210: 'DenseCoeffsBase<Eigen::CoeffBasedProduct<Eigen::Matrix<double,-1,-1,0,-1,-1> const &,Eigen::Matrix<float,3,1,0,3,1> const &,6>,0>' : access declaration can only be applied to a base class member1>src\core\densebase.h(58): error C2602: 'Eigen::DenseCoeffsBase<Derived>::derived' is not a member of a base class of 'Eigen::DenseBase<Derived>'1>          with1>          [1>              Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<double,-1,-1> &,const Eigen::Matrix<float,3,1> &,6>1>          ]1>src\core\densebase.h(58): fatal error C1903: unable to recover from previous error(s); stopping compilation========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========`
jitseniesen
Registered Member
Posts
204
Karma
2

### Re: I want to use Jacobi to get Eigenvalues and Eigenvectors

Mon Feb 04, 2013 10:48 am
tedramsey wrote:Looking at this tutorial getting eigenvalues it seems simple enough. It says to choose your eigendecomposition of which I chose Jacobi SVD

In case you have not found out yet, or otherwise for future readers: JacobiSVD cannot compute eigenvalues, it only computes singular values. Perhaps we should split it in separate tables, one for eigendecompositions and one for singular value decompositions.

## Who is online

Registered users: Baidu [Spider], Bing [Bot], Duarte Ramos, Exabot [Bot], Google [Bot], jcm, jpalacios, MSNbot Media, pympc, rblackwell, TheraHedwig, vlas, wolfi323, Yahoo [Bot], yours-truly, zebulon