[eigen] Re: JacobiSVD and heap allocations

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




2011/2/28 Adolfo Rodríguez Tsouroukdissian <adolfo.rodriguez@xxxxxxxxxxxxxxxx>
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.

It turns out that I did manage to find some time and propose a patch for this issue.
 
Secondly, I was expecting svd.compute(A) to use the computationOptions passed to the constructor, otherwise why specify them in advance?.

I'd still like to hear something on this one :)

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/