![]() Registered Member ![]()
|
Hello,
I would like to know the most efficient way of doing row-by-row operations in sparse matrix. I want to solve a system coming from a reactive transport simulation. This is formulated as a constrained problem, and before actually solving anything I need to reformulate some of the rows (~1/3 to 1/2 of the rows depending on the problem). The rows which must be reformulated are one element on the diagonal and ~3-10 adjacent nonzero entries (The jacobian itself is 100*100 to 5000*5000). The reformulation to do is : row = a e_i + b row ; where a and b are scalar that may depend upon the values in the row (but it is a rare case) . What is the best way to do it ? Is it - by using matrix.innerVector() *= (expression) ? - modifying element by element ? - other ? The problem with setting the good matrix in the first place, without intermediate, is that it will mix two very different algorithms and make the programming more difficult (and less flexible) |
![]() Moderator ![]()
|
At the moment, matrix.innerVector() *= ... is not fully optimal but that should not be too slow either. If performance really matter you might try using an InnerIterator 'iter' and modifying the values through iter.valueRef() = ...
|
![]() Registered Member ![]()
|
ok I will try the innerVector and change if necessary
thanks |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]