petsc-3.14.6 2021-03-30
MatSeqAIJSetPreallocationCSR
Allocates memory for a sparse sequential matrix in AIJ format.
Synopsis
#include "petscmat.h"
PetscErrorCode MatSeqAIJSetPreallocationCSR(Mat B,const PetscInt i[],const PetscInt j[],const PetscScalar v[])
Input Parameters
| B | - the matrix
|
| i | - the indices into j for the start of each row (starts with zero)
|
| j | - the column indices for each row (starts with zero) these must be sorted for each row
|
| v | - optional values in the matrix
|
Notes
The i,j,v values are COPIED with this routine; to avoid the copy use MatCreateSeqAIJWithArrays()
This routine may be called multiple times with different nonzero patterns (or the same nonzero pattern). The nonzero
structure will be the union of all the previous nonzero structures.
Developer Notes
An optimization could be added to the implementation where it checks if the i, and j are identical to the current i and j and
then just copies the v values directly with PetscMemcpy().
This routine could also take a PetscCopyMode argument to allow sharing the values instead of always copying them.
See Also
MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatSeqAIJSetPreallocation(), MatCreateSeqAIJ(), MATSEQAIJ, MatResetPreallocation()
Level
developer
Location
src/mat/impls/aij/seq/aij.c
Implementations
MatSeqAIJSetPreallocationCSR_SeqAIJ in src/mat/impls/aij/seq/aij.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages