[petsc-users] Example for MatInvertBlockDiagonal

Barry Smith bsmith at mcs.anl.gov
Mon Sep 19 14:38:45 CDT 2016


> On Sep 19, 2016, at 2:21 PM, Cyrill Vonplanta <cyrill.von.planta at usi.ch> wrote:
> 
> 
>>  block size > 1 really only makes sense if the block size is really greater than one. So if A has blocks of size 3 you should create A as BAIJ and thus never need to call the convert routine.
> 
> Unfortunately A is not created by my part of the program and comes with blocksize 1.

   Ok, copy the code for MatInvertBlockDiagonal_SeqAIJ() into your source code with a different name and modify it to serve your purpose and call it directly instead of calling MatInvertBlockDiagonal

> 
>> 
>>  You can also set the block size for AIJ matrix to 3 and use MatInvertBlockDiagonal() on that matrix and not use the BAIJ matrix. 
> 
> If I run:
> ierr = MatSetBlockSize(A, 3);  CHKERRQ(ierr);
> 
> It doesn’t work for me. I get:
> 
> [1;31m[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> [0;39m[0;49m[0]PETSC ERROR: Arguments are incompatible
> [0]PETSC ERROR: Cannot change block size 1 to 3
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.6.3, Dec, 03, 2015 
> .
> .
> 
> What are the constraints for block size? 

   You need to set it early in the life of the matrix.

  Barry

> 
> 
> 
> 



More information about the petsc-users mailing list