[petsc-users] my code runs too slow

2010-07-07 Thread abhy...@mcs.anl.gov
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 =

[petsc-users] my code runs too slow

2010-07-07 Thread abhy...@mcs.anl.gov
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 =

[petsc-users] Question about matrix permutation

2010-01-29 Thread abhy...@mcs.anl.gov
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

[petsc-users] Question about matrix permutation

2010-01-29 Thread abhy...@mcs.anl.gov
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:

Does PETSc have some functions like A.*B, A./B in Matlab?

2009-10-29 Thread abhy...@mcs.anl.gov
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

Does PETSc have some functions like A.*B, A./B in Matlab?

2009-10-28 Thread abhy...@mcs.anl.gov
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