Set values of symmetric matrices.

Barry Smith bsmith at mcs.anl.gov
Thu Jun 22 15:11:01 CDT 2006


   Billy,

    A failed linear solve is not considered an "error" by PETSc.
You should "always" call KSPGetConvergedReason() after a solve
to determine if it converged, or if it failed why.

   My guess is that the CG algorithm is detecting that the matrix is
not symmetric. If you use AIJ or BAIJ matrices you have to set all
the values in the matrix, not just the upper part.

    Barry


On Thu, 22 Jun 2006, billy at dem.uminho.pt wrote:

>
> It exits with no error message. Usually I see several PETSC error messages
> before it exits. I tested with MPIAIJ. It works with KSPGMRES or KSPBCGS but
> with KSPCG it exits immediately. Maybe I am missing something.
>
> Billy.
>
>
> Quoting Hong Zhang <hzhang at mcs.anl.gov>:
>
>>
>> Billy,
>>
>> We support cg with MPIAIJ and MPISBAIJ format.
>>
>>> I use MatCreateMPIAIJ to create parallel matrices. I would like to use
>> KSPCG to
>>> solve a symmetric matrices. I tried to implement it but the program exits
>> with
>>> no error.
>>   ^^^^^^^
>> Do you mean with error? If so, what error message?
>>
>>> Do I need only to set values on the diagonal and upper diagonal only
>>> or continue to set all non-zero entries of the matrix?
>>>
>> If you use MPISBAIJ matrix format, then you only need to set the diagonal
>> and upper diagonals. Setting all non-zero entries of the matrix
>> also works - petsc ignores the lower triangular part.
>>
>> Hong
>>>
>>
>>
>
>
>




More information about the petsc-users mailing list