This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 322 - HybridNonlinearSolver might use unitialized (garbage) values for updating jacobian (r1updt)
Summary: HybridNonlinearSolver might use unitialized (garbage) values for updating jac...
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Unsupported modules (show other bugs)
Version: 3.0
Hardware: All All
: --- Unknown
Assignee: Thomas Capricelli
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-03 10:29 UTC by edx
Modified: 2019-12-04 11:00 UTC (History)
2 users (show)



Attachments

Description edx 2011-08-03 10:29:20 UTC
Hi, I posted a question about troubles I originally had on http://forum.kde.org/viewtopic.php?f=74&t=96197 .

HybridNonLinear solver with numerical evaluation of the Jacobian uses Givens rotations to update the Jacobian. Givens rotations are evaluated in r1updt.h, which receives std::vector<JacobiRotation<Scalar> > &v_givens, &w_givens; these vectors have the size of number of unknowns (n), but their values are unitialized. Loops in r1updt update elements of v_givens resp. w_givens, but only if corresponding value v[i] resp. w[i] is non-zero. If the value is zero, the element of v_givens resp. w_givens is not updated (keeping unitialized garbage in it):

 for (j=n-2; j>=0; --j) {
    w[j] = 0.;
    if (v[j] != 0.) {
       /* ... */
       v_givens[j]=givens;
       /* ... */
    }
    /* BUG: what if v[j]==0 ?!! */
 }

*All* values of v_givens resp. w_givens are used in r1mpyq (without testing whether they are valid or not), effectively propagating garbage into the Jacobian.

My solution was to assign zero rotation to those elements, i.e.

 for (j=n-2; j>=0; --j) {
    w[j] = 0.;
    if (v[j] != 0.) {
       /* ... */
    }
    else v_givens[j]=JacobiRotation<Scalar>(1,0);  // <-- added
 }
 
I would like to have someone knowing details of the algorithm to say whether such solution is correct (it works for me).
Comment 1 Thomas Capricelli 2011-08-04 05:04:56 UTC
This is now fixed in both "3.0" and "default" branches.
Comment 2 Nobody 2019-12-04 11:00:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/322.

Note You need to log in before you can comment on or make changes to this bug.