#include "petscmat.h" #include "petscmat.h" PetscErrorCode MatCreateSELL(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt d_rlenmax,const PetscInt d_rlen[],PetscInt o_rlenmax,const PetscInt o_rlen[],Mat *A)Collective

comm | - MPI communicator | |

m | - number of local rows (or PETSC_DECIDE to have calculated if M is given) This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax. | |

n | - This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m. | |

M | - number of global rows (or PETSC_DETERMINE to have calculated if m is given) | |

N | - number of global columns (or PETSC_DETERMINE to have calculated if n is given) | |

d_rlenmax | - max number of nonzeros per row in DIAGONAL portion of local submatrix (same value is used for all local rows) | |

d_rlen | - array containing the number of nonzeros in the various rows of the DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if d_rlenmax is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'. | |

o_rlenmax | - max number of nonzeros per row in the OFF-DIAGONAL portion of local submatrix (same value is used for all local rows). | |

o_rlen | - array containing the number of nonzeros in the various rows of the OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if o_rlenmax is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'. |

A | - the matrix |

It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), MatXXXXSetPreallocation() paradigm instead of this routine directly. [MatXXXXSetPreallocation() is, for example, MatSeqSELLSetPreallocation]

m,n,M,N parameters specify the size of the matrix, and its partitioning across processors, while d_rlenmax,d_rlen,o_rlenmax,o_rlen parameters specify the approximate storage requirements for this matrix.

If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor than it must be used on all processors that share the object for that argument.

The user MUST specify either the local or global matrix dimensions (possibly both).

The parallel matrix is partitioned across processors such that the first m0 rows belong to process 0, the next m1 rows belong to process 1, the next m2 rows belong to process 2 etc.. where m0,m1,m2,.. are the input parameter 'm'. i.e each processor stores values corresponding to [m x N] submatrix.

The columns are logically partitioned with the n0 columns belonging to 0th partition, the next n1 columns belonging to the next partition etc.. where n0,n1,n2... are the input parameter 'n'.

The DIAGONAL portion of the local submatrix on any given processor is the submatrix corresponding to the rows and columns m,n corresponding to the given processor. i.e diagonal matrix on process 0 is [m0 x n0], diagonal matrix on process 1 is [m1 x n1] etc. The remaining portion of the local submatrix [m x (N-n)] constitute the OFF-DIAGONAL portion. The example below better illustrates this concept.

For a square global matrix we define each processor's diagonal portion to be its local rows and the corresponding columns (a square submatrix); each processor's off-diagonal portion encompasses the remainder of the local matrix (a rectangular submatrix).

If o_rlen, d_rlen are specified, then o_rlenmax, and d_rlenmax are ignored.

When calling this routine with a single process communicator, a matrix of type SEQSELL is returned. If a matrix of type MATMPISELL is desired for this

-mat_sell_oneindex | - Internally use indexing starting at 1 rather than 0. Note that when calling MatSetValues(), the user still MUST index entries starting at 0! |

Consider the following 8x8 matrix with 34 non-zero values, that is assembled across 3 processors. Lets assume that proc0 owns 3 rows, proc1 owns 3 rows, proc2 owns 2 rows. This division can be shown

1 2 0 | 0 3 0 | 0 4 Proc0 0 5 6 | 7 0 0 | 8 0 9 0 10 | 11 0 0 | 12 0 ------------------------------------- 13 0 14 | 15 16 17 | 0 0 Proc1 0 18 0 | 19 20 21 | 0 0 0 0 0 | 22 23 0 | 24 0 ------------------------------------- Proc2 25 26 27 | 0 0 28 | 29 0 30 0 0 | 31 32 33 | 0 34

A B C D E F G H I

Where the submatrices A,B,C are owned by proc0, D,E,F are owned by proc1, G,H,I are owned by proc2.

The 'm' parameters for proc0,proc1,proc2 are 3,3,2 respectively. The 'n' parameters for proc0,proc1,proc2 are 3,3,2 respectively. The 'M','N' parameters are 8,8, and have the same values on all procs.

The DIAGONAL submatrices corresponding to proc0,proc1,proc2 are submatrices [A], [E], [I] respectively. The OFF-DIAGONAL submatrices corresponding to proc0,proc1,proc2 are [BC], [DF], [GH] respectively. Internally, each processor stores the DIAGONAL part, and the OFF-DIAGONAL part as SeqSELL matrices. for eg: proc1 will store [E] as a SeqSELL matrix, ans [DF] as another SeqSELL matrix.

When d_rlenmax, o_rlenmax parameters are specified, d_rlenmax storage elements are allocated for every row of the local diagonal submatrix, and o_rlenmax storage locations are allocated for every row of the OFF-DIAGONAL submat. One way to choose d_rlenmax and o_rlenmax is to use the max nonzerors per local rows for each of the local DIAGONAL, and the OFF-DIAGONAL submatrices.

proc0 : d_rlenmax = 2, o_rlenmax = 2 proc1 : d_rlenmax = 3, o_rlenmax = 2 proc2 : d_rlenmax = 1, o_rlenmax = 4We are allocating m*(d_rlenmax+o_rlenmax) storage locations for every proc. This translates to 3*(2+2)=12 for proc0, 3*(3+2)=15 for proc1, 2*(1+4)=10 for proc3. i.e we are using 12+15+10=37 storage locations to store 34 values.

When d_rlen, o_rlen parameters are specified, the storage is specified for every row, coresponding to both DIAGONAL and OFF-DIAGONAL submatrices.

proc0: d_nnz = [2,2,2] and o_nnz = [2,2,2] proc1: d_nnz = [3,3,2] and o_nnz = [2,1,1] proc2: d_nnz = [1,1] and o_nnz = [4,4]Here the space allocated is still 37 though there are 34 nonzeros because the allocation is always done according to rlenmax.

MATMPISELL, MatCreateMPISELLWithArrays()

Index of all Mat routines

Table of Contents for all manual pages

Index of all manual pages