[petsc-users] Round-off / Machine Zero with MatMult

Matthew Knepley knepley at gmail.com
Fri Jun 17 19:09:47 CDT 2016


On Fri, Jun 17, 2016 at 7:05 PM, Paul Urbanczyk <gomer at stanford.edu> wrote:

> Sure... I understand that floating point calculations will not always
> yield exact zero for a number of reasons.
>
> The question I have is why some of the results are exactly zero and others
> are not. I.e. why aren't the numbers all the same? What is different about
> the calculation in rows 0, 1, 8, and 9 from the other rows (2, 3, 4, 5, 6,
> 7)?
>
Different order of operations.

  Matt

> Thanks,
>
> Paul
>
> On 06/17/2016 01:06 PM, Matthew Knepley wrote:
>
> On Fri, Jun 17, 2016 at 2:47 PM, Paul Urbanczyk <gomer at stanford.edu>
> wrote:
>
>> Hello all,
>>
>> I'm using PETSc's "MatMult" function - MatMult(Mat A, Vec x, Vec y) - to
>> do a matrix-vector multiply. The Matrix, A, is anti-symmetric, and the
>> vector, x, is uniform. Thus, the resulting vector, y, should be all zeros.
>>
>> The output I'm seeing typically looks like the following:
>>
>> Vec Object: Vec_0x20b2000_2 1 MPI processes
>>   type: mpi
>> Process [0]
>> 0.
>> 0.
>> -2.08167e-17
>> -2.08167e-17
>> -2.08167e-17
>> -2.08167e-17
>> -2.08167e-17
>> -2.08167e-17
>> 0.
>> 0.
>>
>> Now, I know that -2.08167e-17 is machine zero, but I'm a bit confused why
>> a few of the entries would be exactly zero while others are "machine zero."
>> I would expect them all to be either exactly zero, or machine zero, but not
>> a mixture. Do you have any idea why this might be?
>>
>
> The order of addition matter for roundoff errors.
>
>   Thanks,
>
>     Matt
>
>
>> Thanks for your help!
>>
>> -Paul
>>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160617/bca5f90d/attachment.html>


More information about the petsc-users mailing list