![]() Registered Member ![]()
|
I'm using Visual Studio 2008 but I'm doing something wrong when I want to multiplicate two vectors or matrices.
Every time I compile the following code I'll get a warning: VectorXd v1; VectorXd v2; MatrixXd m(2,2); v1.setZero(2); v2.setZero(2); v1[0]=1; v1[1]=2; v2[0]=0.5; v2[1]=0.25; m=v1*v2.transpose(); warning: \eigen2\eigen\src\core\matrix.h(510) : warning C4305: 'specialization' : truncation from 'const unsigned int' to 'bool' eigen2\eigen\src\core\matrix.h(261) : see reference to function template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols> &Eigen::Matrix<_Scalar,_Rows,_Cols>::_set<Eigen::Product<LhsNested,RhsNested,ProductMode>>(const Eigen::MatrixBase<Derived> &)' being compiled 1> with 1> [ 1> _Scalar=double, 1> _Rows=10000, 1> _Cols=10000, 1> LhsNested=const Eigen::Matrix<double,10000,1> &, 1> RhsNested=const Eigen::Transpose<Eigen::Matrix<double,10000,1>> &, 1> ProductMode=0, 1> Derived=Eigen::Product<const Eigen::Matrix<double,10000,1> &,const Eigen::Transpose<Eigen::Matrix<double,10000,1>> &,0> 1> ] eigentest.cpp(33) : see reference to function template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols> &Eigen::Matrix<_Scalar,_Rows,_Cols>::operator =<Eigen::Product<LhsNested,RhsNested,ProductMode>>(const Eigen::MatrixBase<Derived> &)' being compiled 1> with 1> [ 1> _Scalar=double, 1> _Rows=10000, 1> _Cols=10000, 1> LhsNested=const Eigen::Matrix<double,10000,1> &, 1> RhsNested=const Eigen::Transpose<Eigen::Matrix<double,10000,1>> &, 1> ProductMode=0, 1> Derived=Eigen::Product<const Eigen::Matrix<double,10000,1> &,const Eigen::Transpose<Eigen::Matrix<double,10000,1>> &,0> 1> ] So, this tells me that the memory for a matrix of the size 10000*10000 is allocated, doesn't it? But I know that the product of the two vectors is a 2*2 matrix only. All I want is a multiplication without a warning. Thanks a lot for your help |
![]() Registered Member ![]()
|
Thanks for the report, I just committed a fix (well hopefully it fixes it, i don't have MSVC to try).
Can you please try the 2.0 branch and tell me if it works? as explained here, http://eigen.tuxfamily.org/index.php?ti ... e#Download
No, don't worry ![]() You can check for yourself in any memory debugger that no large memory allocation occured ![]()
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 ![]()
|
Wow, that was quick!
I just tried it with the 2.0 branch and it works like a charm now. No warning is generated anymore. And yeah, you are right, I checked the memory allocation and there isn't space allocated for the 10000*10000 scalars. Thanks a lot for this fast and competent answer! |
Registered users: Bing [Bot], claydoh, gfielding, Google [Bot], markhm, rblackwell, sethaaaa, Sogou [Bot], Yahoo [Bot]