[petsc-users] MatGetSubmatrices from block matrix MPIBAIJ
shu guo
greatgs2008 at gmail.com
Tue Oct 23 09:56:21 CDT 2012
Hi Jed,
Thank you for your reply.
I have figured out how this error happens. When I get a sub-matrix
from a block matrix, Petsc will compress the IS according to the
matrix block format. So for example, if the matrix has a block size
nsbk=4. It will calculate the dimension/nsbk and sort IS accordingly.
The original matrix is like
A1 B1_1 B1_2 B1_3 || A2 B2_1 B2_2 B2_3
so each node has 4 degree of freedom. And the way I permute the matrix
is sort the matrix like,
A1 A2 || B1_1 B1_2 B1_3 B2_1 B2_2 B2_3
So I need the sub-matrix A1 A2. Can you give me a hint how to do it?
Another question is if I do not permute the matrix, so it will hold
the format of
A1 B1_1 B1_2 B1_3 || A2 B2_1 B2_2 B2_3
If I want to get sub-matrix A1 A2 from it. I need a blocked IS, right?
In the manual, I found a statement that saying "For BAIJ matrices the
index sets must respect the block structure, that is if they request
one row/column in a block, they must request all rows/columns that are
in that block. For example, if the block size is 2 you cannot request
just row 0 and column 0." Does it mean that I cannot merely access A1
in the first block? If not, how should I do with this structure if I
want A1 A2 from it?
Thank you very much!
Best,
Shu
On Tue, Oct 23, 2012 at 7:46 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Tue, Oct 23, 2012 at 1:16 AM, shu guo <greatgs2008 at gmail.com> wrote:
>>
>> Hi PETSc Users,
>>
>> I have to subtract a submatrix from a blocked parallel matrix (MPIBAIJ).
>>
>> from K_11 K_12 to get K_11
>> K_21 K_22
>>
>> The code is
>>
>> call ISCreateStride(PETSC_COMM_WORLD,length,0,1,isrowpp,ierr)
>> call MatGetSubMatrices(Kmatem,1,isrowpp,isrowpp,
>> MAT_INITIAL_MATRIX,Kppseq,ierr)
>>
>> When I am running it, the command indicates as
>>
>> [0]PETSC ERROR: --------------------- Error Message
>> ------------------------------------
>> [0]PETSC ERROR: Arguments are incompatible!
>> [0]PETSC ERROR: Indices are not block ordered!
>
>
> Always send the ENTIRE error message.
>
>>
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>>
>>
>> The reason seems pretty clear that the IS need to be in block format
>> either. Although the matrix is created as blocked, during the
>> calculation I have already permute the indices
>
>
> Why are you doing this permutation? How does it look in parallel?
>
>>
>> so that what I need
>> from the matrix is the square matrix exactly from 0--length. Can
>> anyone tell me based on my demand, how should I create this blocked IS
>> to get submatrix? Thank you very much!
>>
>>
>> Best,
>> Shu
>
>
More information about the petsc-users
mailing list