|[eigen] JacobiSVD and heap allocations|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] JacobiSVD and heap allocations
- From: Adolfo Rodríguez Tsouroukdissian <adolfo.rodriguez@xxxxxxxxxxxxxxxx>
- Date: Mon, 28 Feb 2011 18:52:25 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=L59ByeUoTjSsIZViI8sB2hQAQyx8cdJ/JyiOR1Zy+/I=; b=Ly06jKB5h1p6Ocx8xl0CjXctiCnr4AughdIaspBIWV0FjC/rmmypa2Ph+XINOxlbSj +B4wbHuG+Qfwz/Q3yIkovkADVCMZdmGHiKCd74pCTtwBBM2NAz4VSkjXBxxTwYO/PjE5 OEjtJpS9APl3ogEIsJy87xGUjA86kzXW+raio=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=S4RzpvnQ+NugZk5VMGjoCtkz/3ypfiVJ6uNIyCuvyV5MVr3saXS3ZNcuz56JEBlZ84 05lQ1fPNJc4EEaclDTb2Fcd/0V2OjchMToLcY5vO+fx1PjAVv3O3bZ8evOHlUrCu813Q fW2FK/35HXvTNCLOjcolzsr/DXX53MEEBJzU4=
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.
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 :)
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.