[petsc-users] Calculate determinant in PETSc - MatAssemblyEnd breaks

Jed Brown jed at 59A2.org
Wed Jul 28 12:46:14 CDT 2010


On Wed, 28 Jul 2010 19:18:43 +0200, "=?utf-8?b?0J3QtdC80LDRmtCwINCY0LvQuNGb?= (Nemanja Ilic)" <nemanja.ilic.81 at gmail.com> wrote:
> Hello,
> 
> I did the LU factorization and then pulled out diagonal from the matrix, but the code breaks. It breaks on the MatAssemblyEnd after the followin lines:

You really need to tell us how it breaks (send the whole error message),
it's rare that we can tell you what is wrong from "it breaks".

> 	// now populate matrix
> 	ierr = MatAssemblyBegin(Ap, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);
> 	ierr = MatAssemblyEnd(Ap, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);

[...]

> 	ierr = MatLUFactor(Ap, perm, iperm, &info);CHKERRQ(ierr);

This is not the correct interface, you have to use MatGetFactor first,
you don't call MatLUFactor on the matrix you just assembled.  Read the
user's manual and/or look at an example

  http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/mat/examples/tutorials/ex13.c.html

Jed


More information about the petsc-users mailing list