[petsc-users] MatCreateSBAIJ

Mark Adams mfadams at lbl.gov
Mon Mar 21 13:14:30 CDT 2022


This code looks fine to me and the code is
in src/mat/impls/sbaij/seq/sbaij2.c

On Mon, Mar 21, 2022 at 2:02 PM Sam Guo <sam.guo at cd-adapco.com> wrote:

> Dear PETSc dev team,
>    The documentation about MatCreateSBAIJ has following
> "It is recommended that one use the MatCreate
> <https://petsc.org/main/docs/manualpages/Mat/MatCreate.html#MatCreate>(),
> MatSetType
> <https://petsc.org/main/docs/manualpages/Mat/MatSetType.html#MatSetType>()
> and/or MatSetFromOptions
> <https://petsc.org/main/docs/manualpages/Mat/MatSetFromOptions.html#MatSetFromOptions>(),
> MatXXXXSetPreallocation() paradigm instead of this routine directly.
> [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation
> <https://petsc.org/main/docs/manualpages/Mat/MatSeqAIJSetPreallocation.html#MatSeqAIJSetPreallocation>
> ]"
>    I currently call MatCreateSBAIJ directly as follows:
> MatCreateSBAIJ (with d_nnz and o_nnz)
> MatSetValues (to add row by row)
> MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
> MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
> MatSetOption(A, MAT_SYMMETRIC, PETSC_TRUE);
>
>    Two questions:
>    (1) I am wondering whether what I am doing is the most efficient.
>
>    (2) I try to find out how the matrix vector multiplication is
> implemented in PETSc for SBAIJ storage.
>
> Thanks,
> Sam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220321/a18e2f95/attachment.html>


More information about the petsc-users mailing list