MatCreateSeqBDiag

Creates a sequential block diagonal matrix.

Synopsis

int MatCreateSeqBDiag(MPI_Comm comm,int m,int n,int nd,int bs,int *diag,PetscScalar **diagv,Mat *A)
Collective on MPI_Comm

Input Parameters

    diag = i/bs - j/bs  (integer division)
Set diag=PETSC_NULL on input for PETSc to dynamically allocate memory as needed (expensive).
comm - MPI communicator, set to PETSC_COMM_SELF
m - number of rows
n - number of columns
nd - number of block diagonals (optional)
bs - each element of a diagonal is an bs x bs dense matrix
diag - optional array of block diagonal numbers (length nd). For a matrix element A[i,j], where i=row and j=column, the diagonal number is
diagv - pointer to actual diagonals (in same order as diag array), if allocated by user. Otherwise, set diagv=PETSC_NULL on input for PETSc to control memory allocation.

Output Parameters

A -the matrix

Options Database Keys

-mat_block_size <bs> -Sets blocksize
-mat_bdiag_diags <s1,s2,s3,...> -Sets diagonal numbers

Notes

See the users manual for further details regarding this storage format.

Fortran Note

Fortran programmers cannot set diagv; this value is ignored.

Keywords

matrix, block, diagonal, sparse

See Also

MatCreate(), MatCreateMPIBDiag(), MatSetValues()

Level:intermediate
Location:
src/mat/impls/bdiag/seq/bdiag.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages