Registered Member
|
Hi!
I need an advise how to deal with a large matrices. Now I try to find a product of two matrices with this code: #include #include USING_PART_OF_NAMESPACE_EIGEN #define dim 1024 int main(int, char *[]) { Matrix A; Matrix B; Matrix C; srand(2006); A.setRandom(); B.setRandom(); C = A * B; } And I can't even compile it with mingw gcc-4.3 and a lot of errors like " eigen-2.0.0/Eigen/src/Core/Assign.h: In instantiation of 'Eigen::ei_assign_traits, Eigen::Product&, const Eigen::Matrix&, 0> >': eigen-2.0.0/Eigen/src/Core/Assign.h:407: instantiated from 'Derived& Eigen::MatrixBase::lazyAssign(const Eigen::MatrixBase&) [with OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>, Derived = Eigen::Matrix]' eigen-2.0.0/Eigen/src/Core/Assign.h:422: instantiated from 'static Derived& Eigen::ei_assign_selector::run(Derived&, const OtherDerived&) [with Derived = Eigen::Matrix, OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>]' eigen-2.0.0/Eigen/src/Core/Matrix.h:508: instantiated from 'Eigen::Matrix& Eigen::Matrix::_set_noalias(const Eigen::MatrixBase&) [with OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>, _Scalar = float, int _Rows = 1024, int _Cols = 1024, int _Options = 2, int _MaxRows = 1024, int _MaxCols = 1024]' eigen-2.0.0/Eigen/src/Core/Matrix.h:385: instantiated from 'Eigen::Matrix::Matrix(const Eigen::MatrixBase&) [with OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>, _Scalar = float, int _Rows = 1024, int _Cols = 1024, int _Options = 2, int _MaxRows = 1024, int _MaxCols = 1024]' eigen-2.0.0/Eigen/src/Core/MatrixBase.h:497: instantiated from 'const typename Eigen::ei_eval::type Eigen::MatrixBase::eval() const [with Derived = Eigen::Product&, const Eigen::Matrix&, 0>]' eigen-2.0.0/Eigen/src/Core/Assign.h:426: instantiated from 'static Derived& Eigen::ei_assign_selector::run(Derived&, const OtherDerived&) [with Derived = Eigen::Matrix, OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>]' eigen-2.0.0/Eigen/src/Core/Assign.h:442: instantiated from 'Derived& Eigen::MatrixBase::operator=(const Eigen::MatrixBase&) [with OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>, Derived = Eigen::Matrix]' eigen-2.0.0/Eigen/src/Core/Matrix.h:494: instantiated from 'Eigen::Matrix& Eigen::Matrix::_set(const Eigen::MatrixBase&) [with OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>, _Scalar = float, int _Rows = 1024, int _Cols = 1024, int _Options = 2, int _MaxRows = 1024, int _MaxCols = 1024]' eigen-2.0.0/Eigen/src/Core/Matrix.h:263: instantiated from 'Eigen::Matrix& Eigen::Matrix::operator=(const Eigen::MatrixBase&) [with OtherDerived = Eigen::Product&, const Eigen::Matrix&, 0>, _Scalar = float, int _Rows = 1024, int _Cols = 1024, int _Options = 2, int _MaxRows = 1024, int _MaxCols = 1024]' egn2mmul.cpp:24: instantiated from here " are showed. When I reduce dimension, all works. What I do wrong?
Last edited by ameba on Thu Feb 19, 2009 4:45 pm, edited 1 time in total.
|
Registered Member
|
You are trying to use fixed-size 1024x1024. That's very unlikely to work: for such large sizes, you should use dynamic-size instead. So the matrix type you're looking for is MatrixXf, which is a typedef for Matrix. You should use that instead of Matrix.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell