This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Problem with SparseQR

Tags: None
(comma "," separated)
davidmckinnon
Registered Member
Posts
3
Karma
0

Problem with SparseQR

Tue Aug 26, 2014 5:12 pm
Hi,

After following the tutorial code I tried the following example out.

Code: Select all
    static const int num_variables = 10;
    static const int num_constraints = 10;
    SparseMatrix<float> J;
    Matrix<float, num_constraints, 1> b;
    J.resize(num_constraints, num_variables);
    for (int r = 0; r < num_constraints; r++)
    {
        for (int c = 0; c < num_variables; c++)
        {
            J.insert(r, c) = Matrix<float, 1, 1>::Random()(0, 0);
        }
        b(r) = Matrix<float, 1, 1>::Random()(0, 0);
    }

    Eigen::SparseQR<SparseMatrix<float>, COLAMDOrdering<int> > solver;
    J.makeCompressed();
    solver.analyzePattern(J);
    solver.factorize(J);
    Matrix<float, Dynamic, 1> e = solver.solve(b);
    //
    // here we would be updating values in the J (with coeffRef) and b
    //
    //solver.analyzePattern(J); // this fixes the problem
    solver.factorize(J); // CRASH - here!!!
    e = solver.solve(b);


Basically it won't work as specified in the example when I try and run factorize without analyzePattern first. It is obviously not preferable to run COLAMD if the structure of the matrix has not changed.

Cheers,
David...
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
davidmckinnon
Registered Member
Posts
3
Karma
0

Re: Problem with SparseQR

Tue Aug 26, 2014 11:54 pm
Hi Gael,

Great - thanks for the fix, I will try it out now.

Cheers,
David...


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]