[petsc-dev] Error in MatGetDiagonal_Shell?

Smith, Barry F. bsmith at mcs.anl.gov
Mon Apr 30 16:58:10 CDT 2018


https://bitbucket.org/petsc/petsc/pull-requests/951/barry-fix-matgetdiagonal-shell/diff



> On Apr 30, 2018, at 12:38 AM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
> 
> 
>> On Apr 30, 2018, at 3:14 AM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>> 
>> 
>>  I don't understand
>> 
>>   The code has
>> 
>> ierr = MatGetDiagonal(A,W2);CHKERRQ(ierr);
>> ierr = VecView(W2,viewer);CHKERRQ(ierr);
>> 
>>  the output from this VecView seems to match the diagonal of the matrix printed earlier.
>> 
>>> On Apr 29, 2018, at 10:02 AM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
>>> 
>>> By looking at src/mat/examples/tests/output/ex88_1.out, it seems that the output of MatGetDiagonal is wrong for MATSHELL. 
>>> 
>>> it should be 
>>> 2.96782e+08
>>> 1.41731e+09
>>> and not (as computed) 
>>> 1.10918e+08
>>> 2.06459e+08
>> 
>>  What do you mean "as computed"? The output file does not contain
>>> 1.10918e+08
>>> 2.06459e+08
>> anywhere.
>> 
>>  Are you modifying the example and running it again to get the incorrect value?
> 
> Yes, my bad. I did not explain it correctly
> From maint, if you just run ex88 you will get the incorrect output, which is not caught in the nightlyies because floating point values are completely ignored.
> 
> [szampini at localhost tests]$ ./ex88
> Matrix of type: shell
> Mat Object: 1 MPI processes
>  type: seqdense
> 2.9678190300000000e+08 3.9288008100000000e+08 
> 6.1374683500000000e+08 1.4173141580000000e+09 
> Vec Object: 1 MPI processes
>  type: seq
> 3.92973e+19
> 8.54197e+19
> Vec Object: 1 MPI processes
>  type: seq
> 1.10918e+08
> 2.06459e+08
> MatDiagonalSet not tested on MATSHELL
> ….
> 
>> 
>> Barry
>> 
>>> 
>>> -- 
>>> Stefano
>> 
> 



More information about the petsc-dev mailing list