[petsc-users] LSQR with Jacobi preconditioning

Mihai Alexe mihai at vt.edu
Mon Feb 25 03:28:58 CST 2013


Hello,

I'm solving a small least-squares problem with LSQR. I want to set up
Jacobi preconditioning, so I do something like the following:

* MatCreateMPIAIJWithSplitArrays( PETSC_COMM_WORLD, *locrow, *loccol, nrow,*
*  *ncol, onrowidx, oncolidx,*
*  (PetscScalar*) onvals, offrowidx, offcolidx,*
*  (PetscScalar*) values, &A_mat );*
*/* Create Linear Solver Context (and set options) */*
*  KSPCreate( PETSC_COMM_WORLD, &solksp );*
*  KSPSetType( solksp, "lsqr" );*
*
*
*  MatCreateNormal(A_mat, &P_mat);*
*  MatSetUp(P_mat); *
*  KSPSetOperators( solksp, A_mat, P_mat, DIFFERENT_NONZERO_PATTERN );*
*
*
*  KSPGetPC( solksp, &pc);*
*  PCSetType( pc, PCJACOBI );*
*
*
*  KSPSetFromOptions( solksp );*
*  KSPSolve( solksp, b_vec, x_vec );*

However, PETSc detects zeros on the diagonal of P_mat:

[0] PCSetUp_Jacobi(): Zero detected in diagonal of matrix, using 1 at those
locations

I then printed out the indices at which the zeros are detected. It turns
out that PETSC believes that all the diagonal elements are zero.
There is no zero column in my A_mat though... I confirmed this by examining
both A_mat and A_mat^T * A_mat in Matlab.

What am I doing wrong?

kind regards,
Mihai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130225/1074792c/attachment.html>


More information about the petsc-users mailing list