efficient matrix block assignment

Umut Tabak u.tabak at tudelft.nl
Thu Aug 6 08:18:17 CDT 2009

Dear all,

I am trying some block matrix assembly in Petsc, so far, I was puzzling 
with the right calling and set up of MatSetValuesBlocked. Matthew 
Knepley confirmed my previous post. I guess it is the function I should 
use. But it accepts the values as a 1D array, which is  represented in 
row major order(by default). So the burden on this approach is to 
convert my Matrix into a 1D array, this seemed as the only solution for 
the moment. If I would like to use this function.
Another way I could think of by reading the documentation of Matrices, 
is to use MatGetColumnVector and assign over column vectors, but the 
above approach is far more efficient, I guess.

BTW, some blocks are square and some are rectangular, with block size 
type operations, I guess it is not possible to assign rectangular 
matrices to some part of a larger square matrix.

Are there any other efficient suggestions?

Best regards,

More information about the petsc-users mailing list