ierr = KSP_PCApply(ksp,R,Z);CHKERRQ(ierr); /* z <- B*r */
ierr = VecDot(R,Z,&dp);CHKERRQ(ierr);
/*...*/
if (dp < 0.0) {
ksp->reason = KSP_DIVERGED_INDEFINITE_PC;
PetscFunctionReturn(0);
}
Indeed, the following (simple minded, diagonal matrix) test fails
with
-pc_type jacobi, but success with -pc_type none
import sys, petsc4py
petsc4py.init(sys.argv)
from petsc4py import PETSc
import numpy as N
A = PETSc.Mat().createAIJ([10,10])
for i in range(0,5):
A[i,i] = -(i + 1)
for i in range(5,10):
A[i,i] = +(i + 1)
A.assemble()
A.view()
x, b= A.getVecs()
b.set(1)
ksp = PETSc.KSP().create()
ksp.type = 'minres'
ksp.setOperators(A)
ksp.setFromOptions()
ksp.solve(b,x)
On 2/28/08, Barry Smith <bsmith@xxxxxxxxxxx> wrote:
But does it require a positive definite preconditioner?
Barry
On Feb 28, 2008, at 9:32 AM, Matthew Knepley wrote:
Docs are wrong.
Matt
2008/2/28 Lisandro Dalcin <dalcinl@xxxxxxxxx>:
I've noticed that the docs for MINRES say that the operator and
the
preconditioner must be POSITIVE DEFINITE. But I understand
MINRES is
tailored for the symmetric/hermitian-indefinite case.
Are the docs wrong? Or the actual code is a (very peculiar) MINRES
variant?
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería
(CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química
(INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas
(CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to
which
their experiments lead.
-- Norbert Wiener
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594