[petsc-users] Questions about creation of matrix and setting its values

Cong Li solvercorleone at gmail.com
Wed Aug 5 01:23:14 CDT 2015


Hi,

I am wondering if it is necessary to call
MatAssemblyBegin() and MatAssemblyEnd() after MatDuplicate() with the
option of MAT_DO_NOT_COPY_VALUES.
For example, if I have an assembled matrix A, and I call MatDuplicate() to
create B, which is a duplication of A.
Do I need to call MatAssemblyBegin() and MatAssemblyEnd() for B.

And 2nd question is :
just after the MatCreateDense() call and before MatAssemblyBegin()
and MatAssemblyEnd() calls, can I use MatGetArray() ?

The 3rd question is:
before the MatAssemblyBegin() and MatAssemblyEnd() calls, should I use
INSERT_VALUES or ADD_VALUES for MatSetValues call? And why ?
Actually I have read the manual, but I still feel confused about the means
of INSERT_VALUES and ADD_VALUES.

Thanks

Cong Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150805/eca707c4/attachment.html>


More information about the petsc-users mailing list