If you want to use the PETSc to compute the jacobian via finite differencing
then here's the sequence of calls
ierr = SNESComputeDefaultJacobian(ts_snes,CV_Y,J,J,flag);CHKERRQ(ierr);
ierr = MatGetColoring(J,MATCOLORINGSL,iscoloring);CHKERRQ(ierr);
ierr =
Use TSComputeDefaultJacobian instead of SNESComputeDefaultJacobian if you want
to use TS objects only.
ierr =
TSComputeDefaultJacobian(ts,t,CV_Y,J,J,flag,PETSC_NULL);CHKERRQ(ierr);
ierr = MatGetColoring(J,MATCOLORINGSL,iscoloring);CHKERRQ(ierr);
ierr =
You can use MatGetSubMatrix.
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetSubMatrix.html
- Michel Cancelliere michel.cancelliere at polito.it wrote:
Hi all,
I'm implementing a preconditioner that involves to extract some submatrices,
the
Instead of calling MatGetSubMatrix to get each submatrix you can use
MatGetSubMatrices to extract several submatrices at once. See
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetSubMatrices.html#MatGetSubMatrices.
- Jed Brown jed at 59A2.org wrote:
Jed is right.MatGetRow will be efficient than MatGetColumnVector.Don't know
about MatAXPY() though.From the description it looks like it does Matrix +
scalar*Matrix operation.
Shri
- Original Message -
From: Matthew Knepley knep...@gmail.com
To: PETSc users list petsc-users at
If A and B are vectors, then you can use VecPointwiseMult for A.*B and
VecPointwiseDivide for A./B.
For matrices,pointwise multiplication and division functions are not provided
in Petsc. One possible way to do
A.*B and A./B for matrices is to loop through the columns of the matrices,call