[petsc-users] Precision of MatView
Smith, Barry F.
bsmith at mcs.anl.gov
Wed May 15 09:06:09 CDT 2019
The 10-20% in seven digits are presumably printed accurately; it is presumably simply the case that the rest of the digits would be zero and hence are not printed.
> On May 15, 2019, at 8:59 AM, Mark Adams via petsc-users <petsc-users at mcs.anl.gov> wrote:
>
> You are seeing half precision (like 7 digits) in 10-20% of the entries and full in the rest.
>
> Someone will probably chime in who knows about this but I can see where a serial matrix is printed in ASCII Matlab in MatView_SeqAIJ_ASCII in src/mat/impls/aij/seq/aij.c.
>
> I think this line is operative and is should clearly work:
>
> ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,a->j[j]+1,(double)a->a[j]);CHKERRQ(ierr);
>
> Could you run in serial (this code could very well be used for MPI Mats also) with Matlab/ASCII to verify that you have this problem. And you could modify this print statement and remake PETSc, if that's easy, to verify that this code is operative.
>
> I think %18.16e should print 16 digits even if they are 0s ...
>
>
> On Tue, May 14, 2019 at 8:34 PM Sanjay Govindjee <s_g at berkeley.edu> wrote:
> I'm seeing half precision on at least 10 to 20% of the entries :(
> Knowing I should see full precision, I will dig deeper.
>
> -sanjay
> On 5/14/19 5:22 PM, Mark Adams wrote:
>> I would hope you get full precision. How many digits are you seeing?
>>
>> On Tue, May 14, 2019 at 7:15 PM Sanjay Govindjee via petsc-users <petsc-users at mcs.anl.gov> wrote:
>> I am using the following bit of code to debug a matrix. What is the
>> expected precision of the numbers that I will find in my ASCII file?
>> As far as I can tell it is not the full double precision that I was
>> expecting.
>>
>> call PetscViewerASCIIOpen(PETSC_COMM_WORLD,
>> tangview,K_view, ierr)
>> call PetscViewerSetFormat(K_view,
>> PETSC_VIEWER_ASCII_MATLAB, ierr)
>> call MatView (Kmat, K_view, ierr)
>>
>> -sanjay
>>
>
More information about the petsc-users
mailing list