|[eigen] Re: JacobiSVD and heap allocations|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Re: JacobiSVD and heap allocations
- From: Adolfo Rodríguez Tsouroukdissian <adolfo.rodriguez@xxxxxxxxxxxxxxxx>
- Date: Wed, 2 Mar 2011 18:37:58 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=gGkWb/A6EksMQjRR3gXWoySO1oXpnjqBzLeiabBiClA=; b=FKOrowp6DcCgsjWxY8OaN27U94bjwv1IkoEdPpu97dIk0qKj4QHnb1+qegYOyrupEe kcZi8FAuvCw8TmDkaI6dNkEQcNU3cJilcokZ/4CcgxCadmW4GWWtW0mj8+cX5emvujiA 1eXT5KZU2CM8KHp3mkcKot72qogH9n2YKgbRE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=VH22HrT2j5857o/qZEtuaBXQSpyPxBwqpsN+vE3YRgeX1gc1yKcolS3mkpLtrN3bZc KHSb3L4hePql2AsBbgEaUt4rEU9Mj4Gka1IQLq4TF7SSNUSwlJLiBfRwVF6FMrLvnXN+ 5nBmptf1pczvvUuLg4kaN534x/HD8O5xDLOy4=
2011/2/28 Adolfo Rodríguez Tsouroukdissian <adolfo.rodriguez@xxxxxxxxxxxxxxxx>
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?.
I'd still like to hear something on this one :)
Adolfo Rodríguez Tsouroukdissian
PAL ROBOTICS S.L
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.