efficient matrix block assignment

Umut Tabak u.tabak at tudelft.nl
Thu Aug 6 08:55:31 CDT 2009


Matthew Knepley wrote:
> On Thu, Aug 6, 2009 at 8:18 AM, Umut Tabak <u.tabak at tudelft.nl 
> <mailto:u.tabak at tudelft.nl>> wrote:
>
>     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.
>
>
> I need to understand what you mean here. The 1D array we accept here 
> is the input values. It is physically 1D, but conceptually
> 2D, and by default is in row-major order. This has nothing to do with 
> your larger Mat object.
Precisely, what i meant, there is a 2d array which is conceptually a 
matrix in my case(where I read from a Finite element code). So I must 
represent it as a 1D array.
>  
>
>
>     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.
>
>
> Not true. You can have any mxn dimension to the input values. I think 
> there is some underlying confusion here
> that I do not understand. I would suggest you look at the example in 
> the manual.
>
>   Matt
This is also confusing for me for the moment. But there is only one 
parameter, for operation MatSetBlockSize(Mat, blocksize), this was what 
I meant by "block size" above. I should check the docs more, I guess.

Hope made it clear.
Thanks
Umut



More information about the petsc-users mailing list