[petsc-users] Example for MatInvertBlockDiagonal
Cyrill Vonplanta
cyrill.von.planta at usi.ch
Mon Sep 19 10:43:50 CDT 2016
Barry,
Thanks a lot. I’d like to use this for a nonlinear variant of a block-gauss-seidel smoother. I would like to use MatInvertBlockDiagonal for speeding up my variant.
I think I can work with this, however I also have the problem to turn my initial matrix into one with a blocksize of 3.When I call:
MatConvert(A, MATBAIJ, MAT_INITIAL_MATRIX, Dinverse);
Then the matrix Dinverse has blocksize 1 which comes from A. I checked the blocksize before the conversion and it was 3, so it seems to get lost.
What is the correct (and elegant) way to turn a matrix into a block matrix?
Best
Cyrill
On 19/09/16 17:18, "Barry Smith" <bsmith at mcs.anl.gov> wrote:
>
> Cyrill,
>
> This is very specialized for implementing point block Jacobi; I don't think it is something you would want to use directly.
>
> If you do want to use it, it simply returns the inverses of the block diagonals in column major form. You can then call MatSetValues() with with each of those blocks into another PETSc matrix. values[i*bs*bs] is the starting point of each block in the array.
>
> Barry
>
>> On Sep 19, 2016, at 4:55 AM, Cyrill Vonplanta <cyrill.von.planta at usi.ch> wrote:
>>
>> Dear PETSc-Users,
>>
>> I would like to use the inverted block diagonals of a a matrix. I have seen the function MatInvertBlockDiagonal() but I don’t know how to create a matrix out of them or an array of block matrizes.
>>
>> Does anyone have an example on how to use **values to create a PETSc matrix?
>>
>> Thanks
>> Cyrill
>
More information about the petsc-users
mailing list