#include "petscmat.h" PetscErrorCode MatSeqSBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt nz,const PetscInt nnz[])Collective on Mat
B | - the symmetric matrix | |
bs | - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() | |
nz | - number of block nonzeros per block row (same for all rows) | |
nnz | - array containing the number of block nonzeros in the upper triangular plus diagonal portion of each block (possibly different for each block row) or NULL |
-mat_no_unroll | - uses code that does not unroll the loops in the block calculations (much slower) | |
-mat_block_size | - size of the blocks to use (only works if a negative bs is passed in |
You can call MatGetInfo() to get information on how effective the preallocation was; for example the fields mallocs,nz_allocated,nz_used,nz_unneeded; You can also run with the option -info and look for messages with the string malloc in them to see if additional memory allocation was needed.
If the nnz parameter is given then the nz parameter is ignored