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 allocations. Does 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?.