[petsc-users] MatGetRowMinAbs returns negative number
Matthew Knepley
knepley at gmail.com
Wed Jan 4 11:02:07 CST 2012
On Wed, Jan 4, 2012 at 10:48 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Wed, Jan 4, 2012 at 10:40, Matthew Knepley <knepley at gmail.com> wrote:
>
>> I have just noticed that MatGetRowMinAbs (but not the Max variant) in
>>> some cases returns a very small negative number like -1.62505e-17
>>> (displayed as %g). Is this an epsilon effect or an indication of a
>>> problem?
>>>
>>
>> Its not possible that was actually the minimum element?
>>
>
> It is supposed to be returning the absolute value anyway, so no. Also, due
> to this patch of yours
>
> http://petsc.cs.iit.edu/petsc/petsc-dev/rev/e433a0
>
> it should never return a value smaller than 1e-12 that isn't identically
> zero. I don't understand why this shift is being done, but I think that if
> you want a shift like this, it should at least be relative to the norm of
> the vector or something.
>
Okay, here is what is wrong with the logic:
1) Its not a shift, it ignores values < 1.0e-12
2) The problem is on line 2.17 of the diff where it takes the first value
as minimum, but does not take the absolute value
3) After that, no value is greater than 1.0e-12, so it does not change it
You have a whole row of zeros. I will fix that line.
Matt
--
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/20120104/077b1ef3/attachment-0001.htm>
More information about the petsc-users
mailing list