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

row-by-row operations for sparse matrix

Tags: None
(comma "," separated)
fabieng
Registered Member
Posts
8
Karma
0
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)
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
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() = ...
fabieng
Registered Member
Posts
8
Karma
0
ok I will try the innerVector and change if necessary
thanks


Bookmarks



Who is online

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