petsc-3.7.1 2016-05-15
Report Typos and Errors

# MatCreateSeqBAIJ

Creates a sparse matrix in block AIJ (block compressed row) format. For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz). By setting these parameters accurately, performance during matrix assembly can be increased by more than a factor of 50.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode  MatCreateSeqBAIJ(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A)

Collective on MPI_Comm Many br

### Input Parameters

| comm | - MPI communicator, set to PETSC_COMM_SELF Many br
| bs | - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row Many brblocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() Many br
| m | - number of rows Many br
| n | - number of columns Many br
| nz | - number of nonzero blocks per block row (same for all rows) Many br
| nnz | - array containing the number of nonzero blocks in the various block rows Many br(possibly different for each block row) or NULL Many br

### Output Parameter

A -the matrix Many br

It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), Many brMatXXXXSetPreallocation() paradgm instead of this routine directly. Many br[MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation] Many br

### Options Database Keys

-mat_no_unroll -uses code that does not unroll the loops in the Many brblock calculations (much slower) Many br
-mat_block_size -size of the blocks to use Many br

Many br

### Notes

The number of rows and columns must be divisible by blocksize. Many br

If the nnz parameter is given then the nz parameter is ignored Many br

A nonzero block is any block that as 1 or more nonzeros in it Many br

The block AIJ format is fully compatible with standard Fortran 77 Many brstorage. That is, the stored row and column indices can begin at Many breither one (as in Fortran) or zero. See the users' manual for details. Many br

Specify the preallocated storage with either nz or nnz (not both). Many brSet nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory Many brallocation. See Users-Manual: ch_mat for details. Many brmatrices. Many br

### See Also

MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ()

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

### Examples

src/tao/unconstrained/examples/tutorials/rosenbrock1.c.html
src/tao/unconstrained/examples/tutorials/rosenbrock1f.F.html