MatSeqSBAIJSetPreallocationCSR — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# MatSeqSBAIJSetPreallocationCSR

Creates a sparse parallel matrix in `MATSEQSBAIJ` format using the given nonzero structure and (optional) numerical values

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatSeqSBAIJSetPreallocationCSR(Mat B, PetscInt bs, const PetscInt i[], const PetscInt j[], const PetscScalar v[])

## Input Parameters

- B - the matrix

- bs - size of block, the blocks are ALWAYS square.

- i - the indices into `j` for the start of each local row (indices start with zero)

- j - the column indices for each local row (indices start with zero) these must be sorted for each row

- v - optional values in the matrix, use `NULL` if not provided

## Notes

The `i`,`j`,`v` values are COPIED with this routine; to avoid the copy use `MatCreateSeqSBAIJWithArrays()`

The order of the entries in values is specified by the `MatOption` `MAT_ROW_ORIENTED`. For example, C programs may want to use the default `MAT_ROW_ORIENTED` = `PETSC_TRUE` and use an array v[nnz][bs][bs] where the second index is over rows within a block and the last index is over columns within a block row. Fortran programs will likely set `MAT_ROW_ORIENTED` = `PETSC_FALSE` and use a Fortran array v(bs,bs,nnz) in which the first index is over rows within a block column and the second index is over columns within a block.

Any entries provided that lie below the diagonal are ignored

Though this routine has Preallocation() in the name it also sets the exact nonzero locations of the matrix entries and usually the numerical values as well

## See Also

Matrices, `Mat`, `MATSEQSBAIJ`, `MatCreate()`, `MatCreateSeqSBAIJ()`, `MatSetValuesBlocked()`, `MatSeqSBAIJSetPreallocation()`

## Level

advanced

## Location

src/mat/impls/sbaij/seq/sbaij.c

## Implementations

MatSeqSBAIJSetPreallocationCSR_SeqSBAIJ() in src/mat/impls/sbaij/seq/sbaij.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages