The MatMatSolve mystery

Barry Smith bsmith at mcs.anl.gov
Wed Sep 10 15:54:44 CDT 2008


   For the MatMatSolve_SeqAIJ() to work both B and X must be dense  
matrices,
since you passed in a sparse SeqAIJ matrix (the default) for B you get  
garbage out.
I will add an error check telling you the B matrix is not dense so no  
one will fall for this
again.

    Barry


On Sep 10, 2008, at 3:39 PM, Nicolas Tardieu wrote:

> Dear PETSc users,
>
> The attached file is a naive test of MatMatSolve : I create a  
> matrix,say A, I duplicate it, say BB, and I would like to compute  
> A^{-1}*BB.
> Since A is the identity matrix, I would like to get the identity  
> matrix. But I don't!
> Here is what I obtain by doing "./niko1f -n 3" :
>
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  A before MatMatSolve
> row 0: (0, 1)
> row 1: (1, 1)
> row 2: (2, 1)
>  BB before MatMatSolve
> row 0: (0, 1)
> row 1: (1, 1)
> row 2: (2, 1)
>  XX before MatMatSolve
> 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
> 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
> 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
>  XX after MatMatSolve
> 1.0000000000000000e+00 1.9966503766457982e-314 7.9050503334599447e-323
> 1.0000000000000000e+00 0.0000000000000000e+00 6.4996731077266291e-311
> 1.0000000000000000e+00 2.6136072665001942e-321 9.6616869034104132e-317
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>
>
> Can you tell me what I am doing wrong?
>
> Thanks,
>
> Nicolas
>
> <niko1f.F>




More information about the petsc-users mailing list