Well you are doing nothing wrong. When I run the code I get the same results 
as you. I dump the matrix into Matlab and it has a negative eigenvalue so the 
example is wrong. The code is handling it correctly. 

>> eig(full(Mat_0))

ans =

   -0.8042
    0.1716
    0.6489
    1.0000
    1.0000
    1.0000
    1.0000

   I am cc:iing Victor who supposedly wrote the original example.

   Barry

Attached is the matrix saved with -mat_view_matlab



On Aug 23, 2010, at 11:17 PM, Anush Krishnan wrote:

> 
> Message: 6
> Date: Mon, 23 Aug 2010 18:40:34 -0500
> From: Barry Smith <bsmith at mcs.anl.gov>
> Subject: Re: [petsc-dev] Problem with conjugate gradient solver
> To: For users of the development version of PETSc
>        <petsc-dev at mcs.anl.gov>
> Message-ID: <6432610F-F243-4C9C-AB6A-0944221AE18D at mcs.anl.gov>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> On Aug 23, 2010, at 2:31 PM, Anush Krishnan wrote:
> 
> > Hi,
> >
> > I was trying to compile and run the example file 
> > $PETSC_DIR/src/ksp/pc/examples/tutorials/ex3.c, which demonstrates PETSc's 
> > preconditioned conjugate gradient solver for a system of linear equations. 
> > After compiling, running make runex3 is supposed to throw up the error 
> > "Divergence because of indefinite preconditioner" and running make 
> > runex3_pd is supposed to work and give the correct solution. But instead I 
> > get the error "Other kind of divergence: this should not happen." for the 
> > latter. Is there some bug in the code, or are there any other options that 
> > need to be set?
> 
>   Hmm, worked for me.
> 
>    Please hg pull; hg update then rebuild PETSc and run the make runex3 
> runex3_pd again and send the output. I added to that example what reason it 
> did have to maybe help determine the problem. Or you can run the example with 
> the options given in the makefile and also the option -ksp_converged_reason
> 
> I've attached the outputs I got with runex3 and runex3_pd (1 and 2 
> respectively. I commented out the statements after the execute commands to 
> prevent deletion of the generated output files). This was on revision 16788.
> 
> Thanks,
> Anush
>   
> 
> 
>   Barry
> 
> >
> > Thanks,
> > Anush
> <ex3_inode.out_1><ex3_inode.out_2><ex3.tmp_1><ex3.tmp_2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100824/092e404f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jeff.m
Type: application/octet-stream
Size: 64834 bytes
Desc: not available
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100824/092e404f/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100824/092e404f/attachment-0001.html>

Reply via email to