Question on adding matrix rows and columns
Tobias Neckel
neckel at in.tum.de
Sat Feb 28 10:58:17 CST 2009
Hello,
I need to weight and add a certain number of rows and columns from one matrix
(A) into another one (B) where I just know the corresponding row and column
indices, but not the indices of the entries inside one row or one column.
For the rows, I managed to do so by calling MatGetRow() (and MatRestoreRow()) on
A, getting the corresponding column indices and values to work with and add into
B.
For the columns, however, I just found MatGetColumnIJ() and MatGetColumnVector()
in the online manual.
The first seems to give access to columns and corresponding indices, but I am
not sure if n corresponds to the total number of columns or just all non-zero
columns.
The latter (besides the warning of possibly being slow) seems to return the
complete vector of values, but no indices. Is my interpretation correct so far?
A bit weired workaround would be to transpose A each time a column needs to be
accessed and use MatGetRow() etc. again and retranspose afterwards. Or copying
the transpose of A into another matrix meaning twice the amount of data in the
RAM which I would like to avoid.
What would you suggest to do?
Thanks and best regards
Tobias
--
Dipl.-Tech. Math. Tobias Neckel
Institut für Informatik V, TU München
Boltzmannstr. 3, 85748 Garching
Tel.: 089/289-18602
Email: neckel at in.tum.de
URL: http://www5.in.tum.de/persons/neckel.html
More information about the petsc-users
mailing list