Glas :[glas] cursor and permuted vector |
From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2006-06-17 07:51:29
Hi,
I spoke to our colleague Greg yesterday who is developing finite element
software and he wanted some permutations of a vector (related to some
ordering of eigenvalues). It is something we did not yet think of. He was
refering to where this done in matlab. (Matlab is a great source of
inspiration for glas for both functionality as syntax).
Concerning permutations, I see three possibilities:
* We can add a permutation algorithm and a related view, without permuting the
vector explicitly, which has some advantages when the value_type is quite
large in size.
* Add a function to permute a vector explicitly
* Add both.
For those who are familiar with the current svn tree ...
Toon and I have introduced cursors (can be an index or a pointer or an
iterator) to walk over an expression and funtions to increment the cursor:
vector.next(cursor)
vector.next(cursor,step)
and evaluate
vector.value(cursor)
vecor.index(cursor) (for the sparse case only)
Currently cursors can only walk in a forward way over the vector. (cfr
ForwardIterator)
With such a permutation, this is a case where prev(cursor) and
prev(cursor,step) should be added to the SparseVectorExpression and
DenseVectorExpression concepts.
Algorithms carried out on a permutated vector, using next(cursor) and
next(cursor,step) need the prev() functions to implement the next() of such a
permuted vector (without explicitly carrying out the permutation), although I
am unsure it is enough. We might need a random access change of the cursor
also for efficiency reasons. This should become clear once we implement
permuations on vector expressions.
Karl