Registered Member
|
This Eigen sequence
Map<MatrixXd> W(W_ptr, count, count); MatrixXd T(count, count); ... T.computeInverse(&W); gives an error for the last line stating no matching function for call to 'Eigen::Matrix<double, 10000, 10000, 3, 10000, 10000>::computeInverse(Eigen::Map<Eigen::Matrix<double, 10000, 10000, 3, 10000, 10000>, 1>*) So, how does one properly pass 1) a reference or 2) a pointer to an Eigen method that expects the *non-mapped* equivalent? Without the Map<>, everything is fine but I want the Map so as to avoid excessive malloc() calls [by pre-allocating a big buffer]. TIA. |
Registered Member
|
Hm this was a limitation of Eigen 2.0. computeInverse() expected that the destination type is the plain-matrix version of the current type.
I've fixed that for you in the 2.0 branch, enjoy! Meanwhile the default branch has been fixed long ago.
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
|
Perhaps I misunderstood your reply ("2.0 branch").
I went to the Eigen site and re-downloaded the 2.0.11 "latest stable release" (.zip) but nothing has changed. It still gives the error cited above. I did not, and never have, downloaded source code or anything but the stable-release link. |
Registered Member
|
The 2.0 branch is the branch that will eventually be released as 2.0.12. It's the stable branch. In order to get it:
http://bitbucket.org/eigen/eigen/get/2.0.tar.bz2 (other formats possible, see http://eigen.tuxfamily.org/index.php?ti ... e#Download)
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
|
After using the modified version of Eigen, the error with computeInverse() went away but I got a similar one elsewhere, viz.,
-(void)aFunc:(MatrixXd&)M { ... } Map<MatrixXd> M(M_ptr, count, count); [self afunc:M]; gives warning: cannot pass objects of non-POD type 'class Eigen::Map<Eigen::Matrix<double, 10000, 10000, 3, 10000, 10000>, 1>' through '...'; call will abort at runtime |
Registered Member
|
The code that you pasted isn't c++
But since that seems to be the question, if you want to write a function that can take seamlessly either a matrix or a map, you have to let it take a MatrixBase<Derived>, template in Derived. See the code example there: http://eigen.tuxfamily.org/dox/classEig ... xBase.html
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
|
"The code that you pasted isn't c++ "
but it *was* a header for a .mm file so it should have been OK. On the other hand, I cannot begin to fathom what "...you have to let it take a MatrixBase<Derived>, template in Derived" is supposed to mean and the supplied link has so many examples of so many kinds that I cannot tell to which you refer. Could you give a line number on that page? Thanks. |
Registered Member
|
Well, there are indeed many examples for the specific methods in this class, but there's only one example in the class' own description,
Sorry, I don't know what .mm files are?
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
|
Hi,
I have question that is similar to the OP. I would like to do a LDLt factorization on a Mapped matrix, but the LDLt function seems to only like plain Eigen matrices, even though const LDLT< typename MatrixBase< Derived >::PlainMatrixType > ldlt ( ) const [inline] is specified in http://eigen.tuxfamily.org/dox/classEig ... xBase.html I think I am misunderstanding Benoit's recommendation. Here is my function (I am using the devel branch)
and here is the compiler error I get when I try to do it with Map
|
Moderator
|
indeed, this is a bug in the ldlt() function. Problem solved en both branches.
Also note that Map objects are writable, so you can do: Map<VectorXd>(d,n[0]) = AA.ldlt().vectorD(); |
Registered Member
|
Hi Gael,
Thank you for fixing this compilation error. It is working now, apart from an additional bug. When the matrix whose LDLt decomposition is sought is positive semi-definite but rank-deficient, the vectorD() method (sometimes) puts 1.0 where 0.0 should be. Thus, when you multiply the all factors together, it does not equal the original matrix. Here is an example of a 5x5 matrix whose rank is 2 where vectorD() produces the wrong answer, namely
|
Registered Member
|
Thanks for the great test case. Bug fixed, see the mailing list.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]