[eigen] JacobiSVD and heap allocations

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hello,

Now that 3.0 is fast approaching, I took a moment to play around with the new implementation of the JacobiSVD (Eigen3 beta 4). The first and most important thing I noticed is that the problem size constructor no longer preallocates all of its resources. Example code:

MatrixXd A = MatrixXd::Random(rows, cols);
Eigen::JacobiSVD<MatrixXd> svd(rows, cols, Eigen::ComputeThinU | Eigen::ComputeThinV); // Performs 4 allocations
svd.compute(A); // Performs 7 allocations, but does not compute U nor V!
svd.compute(A, Eigen::ComputeThinU | Eigen::ComputeThinV); // Performs 8 allocationsDoes compute U and V

All (undesired) allocations performed by compute() take place in lines 558-559 of JacobiSVD:

if(!internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows>::run(*this, matrix)
  && !internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreRowsThanCols>::run(*this, matrix))

I ticketed this as issue 206.

Secondly, I was expecting svd.compute(A) to use the computationOptions passed to the constructor, otherwise why specify them in advance?.

I'll most probably be out of the office for ~3 weeks, so won't be able to look into it until then. Anyway, I wanted to bring some attention to the issue.

Other than that, beta 4 is looking good :)

Cheers,

Adolfo.


--
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09

CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may contain confidential information which is privileged and intended only for the individual or entity to whom they are addressed.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of this e-mail and/or accompanying document(s) is strictly prohibited.  If you have received this e-mail in error, please immediately notify the sender at the above e-mail address.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/