Re: [eigen] JacobiSVD::compute does malloc for non-square matrices

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




On Wed, May 18, 2011 at 6:32 PM, <hamelin.philippe@xxxxxxx> wrote:
Thank you! I will give a try. Do I have to apply all patches or only "part 4: Removes heap allocations from JacobiSVD and its preconditioners" ?

I believe that part 1 has already been merged on the dev branch, but you do need to apply parts 2-4. This is because memory allocations were not only taking place in JacobiSVD itself, but also on Householder sequence and QR decomposition classes that are used in the different preconditioners.

Adolfo.

 
Philippe


De : Listengine [mailto:listengine@xxxxxxxxxxxxxxxxx] De la part de Adolfo Rodríguez Tsouroukdissian
Envoyé : 18 mai 2011 11:55
À : eigen@xxxxxxxxxxxxxxxxxxx
Objet : Re: [eigen] JacobiSVD::compute does malloc for non-square matrices

On Wed, May 18, 2011 at 5:24 PM, <hamelin.philippe@xxxxxxx> wrote:
Hello,
 
I'm trying to use the SVD in a real-time process, so I can't do any malloc. I found that my SVD (JacobiSVD) was doing some malloc, even when the pre-allocation ctor is used. The jacobi unit tests (jacobisvd_preallocate) does make this validation, but only for a square 3x3 matrix. The same test fail when using non-square matrices. Here is an example of a failing test:
 
bool testSVDNoMalloc()
{
    const int rows = 15;
    const int cols = 15;
 
    Eigen::MatrixXd A = Eigen::MatrixXd::Random(rows, cols);
 
    Eigen::JacobiSVD<Eigen::MatrixXd> svd1(rows, cols);
    Eigen::internal::set_is_malloc_allowed(false);
    svd1.compute(A);
    Eigen::internal::set_is_malloc_allowed(true);
 
    return true;
}
 
Is this a bug or maybe I misunderstood something?

Philippe,

There is an open bug [1] with patches that fix heap allocations for the JacobiSVD::compute method. However, some of them are still pending for review, hence have not yet been integrated in the dev branch. If you feel brave, feel free to give them a test drive. They work for me, and don't have side effects as per the unit tests.

As a side note which might be of interest, once bug 206 is closed, I'd like to take on fixing heap allocations on JacobiSVD::solve method, plus propose adding a mechanism for generalizing the computation of the inverse of the singular values, so that one can not only perform pure least squares inverses/linear system solve, but also add other criteria to the optimization (eg. regularization).

[1] http://eigen.tuxfamily.org/bz/show_bug.cgi?id=206

HTH,

Adolfo
 
 
Thank you,
 
------------------------------------
Philippe Hamelin
, ing. jr, M. Ing
Chercheur / Researcher

T: 450-652-8499 x2198
F: 450-652-1316

Expertise robotique et civil
Institut de recherche d'Hydro-Québec (IREQ)
1740, boul. Lionel-Boulet
Varennes (QC) J3X 1S1, Canada

 



--
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.



--
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/