Registered Member
|
Hello,
I'm a new user of Eigen, and inexperienced with expression templates (and far from expert in linear algebra either) HOWEVER - I want to translate a Matlab routine which was sent to me by another programmer into C++ and incorporate it into a large existing data analysis program. The routine involves fairly extensive linear algebra, so I downloaded and installed Eigen. I first programmed the Matlab routine as a standalone test program, and got an exe file working OK (i.e. producing the same output as Matlab). But when I then incorporate the exact same routines into my existing (large) program and try to compile the container cpp file (not the whole program), the compiler crashes displaying the dialog box "Microsoft (R) C/C++ Optimizing Compiler has stopped working. Windows is checking for a solution to this problem.". Eventually this message disappears, and VS returns to editing mode. The point at which this crash occurs in my code is rather variable, but the following line routinely crashes it: VectorXd phi1=amat1.jacobiSvd(ComputeThinU | ComputeThinV).solve(amatDiv); As I said, this works fine in a standalone test program, and amat1 and amatDiv both contain the correct data as tested against the Matlab original. Furthermore, various Eigen operations compile fine up to that point. I would appreciate any advice as to what might be causing the crash and how to avoid it. When Visual Studio returns to editing mode, the Build output shows the following: 1> InverseSpikeFilterByCoB.cpp 1>c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\core\product.h(276): fatal error C1001: An internal error has occurred in the compiler. 1> (compiler file 'msc1.cpp', line 1420) 1> To work around this problem, try simplifying or changing the program near the locations listed above. 1> Please choose the Technical Support command on the Visual C++ 1> Help menu, or open the Technical Support help file for more information 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\core\product.h(262) : see reference to function template instantiation 'void Eigen::internal::outer_product_selector<0>::run<Eigen::GeneralProduct<Lhs,Rhs,ProductType>,Dest>(const Eigen::GeneralProduct<Lhs,Rhs,ProductType> &,Dest &,double)' being compiled 1> with 1> [ 1> Lhs=Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>, 1> Rhs=Eigen::Map<Eigen::Matrix<double,1,-1>,0>, 1> ProductType=2, 1> Dest=Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,-1,false>,-1,-1,false> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\core\productbase.h(124) : see reference to function template instantiation 'void Eigen::GeneralProduct<Lhs,Rhs,ProductType>::scaleAndAddTo<Dest>(Dest &,double) const' being compiled 1> with 1> [ 1> Lhs=Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>, 1> Rhs=Eigen::Map<Eigen::Matrix<double,1,-1>,0>, 1> ProductType=2, 1> Dest=Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,-1,false>,-1,-1,false> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\core\productbase.h(121) : see reference to function template instantiation 'void Eigen::ProductBase<Derived,Lhs,Rhs>::scaleAndAddTo<Dest>(Dest &,double) const' being compiled 1> with 1> [ 1> Derived=Eigen::GeneralProduct<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>,Eigen::Map<Eigen::Matrix<double,1,-1>,0>,2>, 1> Lhs=Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>, 1> Rhs=Eigen::Map<Eigen::Matrix<double,1,-1>,0>, 1> Dest=Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,-1,false>,-1,-1,false> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\core\noalias.h(86) : see reference to function template instantiation 'void Eigen::ProductBase<Derived,Lhs,Rhs>::subTo<ExpressionType>(Dest &) const' being compiled 1> with 1> [ 1> Derived=Eigen::GeneralProduct<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>,Eigen::Map<Eigen::Matrix<double,1,-1>,0>,2>, 1> Lhs=Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>, 1> Rhs=Eigen::Map<Eigen::Matrix<double,1,-1>,0>, 1> ExpressionType=Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,-1,false>,-1,-1,false>, 1> Dest=Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,-1,false>,-1,-1,false> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\householder\householder.h(107) : see reference to function template instantiation 'ExpressionType &Eigen::NoAlias<ExpressionType,StorageBase>::operator -=<Eigen::GeneralProduct<Lhs,Rhs,ProductType>,Lhs,Rhs>(const Eigen::ProductBase<Derived,Lhs,Rhs> &)' being compiled 1> with 1> [ 1> ExpressionType=Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,-1,false>,-1,-1,false>, 1> StorageBase=Eigen::MatrixBase, 1> Lhs=Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>, 1> Rhs=Eigen::Map<Eigen::Matrix<double,1,-1>,0>, 1> ProductType=2, 1> Derived=Eigen::GeneralProduct<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>,const Eigen::Block<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,-1,1,false>>,Eigen::Map<Eigen::Matrix<double,1,-1>,0>,2> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\qr\colpivhouseholderqr.h(446) : see reference to function template instantiation 'void Eigen::MatrixBase<Derived>::applyHouseholderOnTheLeft<Eigen::VectorBlock<VectorType>>(const EssentialPart &,const double &,double *)' being compiled 1> with 1> [ 1> Derived=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,-1,false>, 1> VectorType=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>, 1> EssentialPart=Eigen::VectorBlock<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\qr\colpivhouseholderqr.h(373) : while compiling class template member function 'Eigen::ColPivHouseholderQR<_MatrixType> &Eigen::ColPivHouseholderQR<_MatrixType>::compute(const Eigen::Matrix<_Scalar,_Rows,_Cols> &)' 1> with 1> [ 1> _MatrixType=Eigen::Matrix<double,-1,-1>, 1> _Scalar=double, 1> _Rows=-1, 1> _Cols=-1 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\svd\jacobisvd.h(144) : see reference to class template instantiation 'Eigen::ColPivHouseholderQR<_MatrixType>' being compiled 1> with 1> [ 1> _MatrixType=Eigen::Matrix<double,-1,-1> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\svd\jacobisvd.h(138) : while compiling class template member function 'bool Eigen::internal::qr_preconditioner_impl<MatrixType,QRPreconditioner,Case>::run(Eigen::JacobiSVD<_MatrixType> &,const MatrixType &)' 1> with 1> [ 1> MatrixType=Eigen::Matrix<double,-1,-1>, 1> QRPreconditioner=2, 1> Case=0, 1> _MatrixType=Eigen::Matrix<double,-1,-1> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\svd\jacobisvd.h(598) : see reference to class template instantiation 'Eigen::internal::qr_preconditioner_impl<MatrixType,QRPreconditioner,Case>' being compiled 1> with 1> [ 1> MatrixType=Eigen::Matrix<double,-1,-1>, 1> QRPreconditioner=2, 1> Case=0 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\svd\jacobisvd.h(586) : while compiling class template member function 'Eigen::JacobiSVD<_MatrixType> &Eigen::JacobiSVD<_MatrixType>::compute(const Eigen::Matrix<_Scalar,_Rows,_Cols> &,unsigned int)' 1> with 1> [ 1> _MatrixType=Eigen::Matrix<double,-1,-1>, 1> _Scalar=double, 1> _Rows=-1, 1> _Cols=-1 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\svd\jacobisvd.h(721) : while compiling class template member function 'Eigen::JacobiSVD<_MatrixType> Eigen::MatrixBase<Derived>::jacobiSvd(unsigned int) const' 1> with 1> [ 1> _MatrixType=Eigen::Matrix<double,-1,-1>, 1> Derived=Eigen::Matrix<double,-1,-1> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\core\plainobjectbase.h(66) : see reference to class template instantiation 'Eigen::MatrixBase<Derived>' being compiled 1> with 1> [ 1> Derived=Eigen::Matrix<double,-1,-1> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\eigen\eigen-eigen-6e7488e20373\eigen\src\core\matrix.h(142) : see reference to class template instantiation 'Eigen::PlainObjectBase<Derived>' being compiled 1> with 1> [ 1> Derived=Eigen::Matrix<double,-1,-1> 1> ] 1> c:\users\wjh\documents\visual studio 2010\projects\egaa32\inversespikefilterbycob.cpp(161) : see reference to class template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols>' being compiled 1> with 1> [ 1> _Scalar=double, 1> _Rows=-1, 1> _Cols=-1 1> ] 1> 1>Build FAILED. |
Moderator
|
clearly visual studio sucks, but we already knew that More seriously, I can only suggest you to try to isolate as much as possible the Eigen part into a separate cpp file. You might also check the compiler flags which are used for your big application and try to compile the standalone app with the exact same flags. Then you might also try to include the common header files of your big app from your standalone one to see if something happen...
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell