The MatMatSolve mystery

Barry Smith bsmith at mcs.anl.gov
Wed Sep 10 16:31:32 CDT 2008


   Satish,

    Could you please make a patch to fix this. The loop
   for (neq=0; neq<n; neq++){
should be
   for (neq=0; neq<B->cmap.n; neq++){

   Thanks

   Barry

On Sep 10, 2008, at 4:18 PM, Nicolas Tardieu wrote:

> Thanks a lot!
> I have changed the code but I still have strange behaviour.
> I scaled the identity matrix and enlarged the BB matrix :
>
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
>  A before MatMatSolve
> row 0: (0, 1e-06)
> row 1: (1, 1e-06)
>  BB before MatMatSolve
> 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+03  
> 0.0000000000000000e+00
> 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00  
> 1.0000000000000000e+03
>  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
>  XX after 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
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>
> Nicolas
>
>
> 2008/9/10 Barry Smith <bsmith at mcs.anl.gov>
>
>  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>
>
>
> <niko1f.F>




More information about the petsc-users mailing list