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

problem in lazy evaluation with sparse objects

Tags: None
(comma "," separated)
Seb
Registered Member
Posts
99
Karma
0
I probably found a bug:

Vector2=something;
Vector1 = Vector2;

the solution of
vec = sparse_mat.transpose() * Vector1 is right.

vec = sparse_mat.transpose() * (Vector1+Vector2)*0.5 is wrong.

Last edited by Seb on Fri Feb 20, 2009 5:14 pm, edited 1 time in total.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
do you have a complete test code because I cannot reproduce the bug
Seb
Registered Member
Posts
99
Karma
0
ggael wrote:do you have a complete test code because I cannot reproduce the bug


Yes!

Code: Select all
// result looks reasonable:
   TVector tmp1 = global_stiffness_matrix * constraintVectorRhs();
   constraintVectorRhsLoad() = constraint_matrix.transpose() * tmp1;
// should be the same as stffness is symmetric in the test case:
   TVector tmp1 = global_stiffness_matrix * constraintVectorRhs();
    TVector tmp2 = global_stiffness_matrix.transpose() * constraintVectorRhs();
    constraintVectorRhsLoad() = constraint_matrix.transpose() * (tmp1+tmp2)*0.5;
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
sorry, but I cannot reproduce the issue. Actually your example is not helping much, what is TVector ? how is declared global_stiffness_matrix ? etc.
Seb
Registered Member
Posts
99
Karma
0
The data types are default VectorXd and SparseMatrix . But I found the origin: The input vector contained uninitialized values. I did not really discover the location of the programming error, but will look into that later. Funny that there are two different solutions. But no wonder that they were wrong...


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell