Registered Member
|
How create an identity matrix of size N? I found the DiagonalMatrix class and though it would be useful after calling the setIdentity method but later I just can't multiply it by a scalar and add to a SparseMatrix. What else can I use to achieve this effect?
Thanks. |
Moderator
|
to add a constant to the diagonal of a sparse matrix have a look at this thread:
viewtopic.php?f=74&t=95552 |
Registered Member
|
That code adds the value to the first column of the matrix, or something. I am using a SparseMatrix, not a triangular one.
|
Moderator
|
Then increment the iterator until it.index()==j and add the value. Of course this assume the diagonal entries already exists.
|
Registered Member
|
I did this instead
Thanks for the help. |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]