commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject Re: [Math] "NonPositiveDefiniteMatrixException" message and meaning
Date Fri, 09 Sep 2011 18:26:02 GMT
On 9/9/11 9:27 AM, Ted Dunning wrote:
> I don't think that is correct.
> It is not the case that there was some element in the input that was too
> small.  For instance, this matrix is positive definite:
>     3   -3    1
>     2    4    2
>     1    1   30
> While this one is not
>     3   -3    1
>     2    3    2
>     1    1   30
> The value of the diagonal that triggers the error message will be some
> negative number that does not appear in the original matrix.
> For a non-pivoting Cholesky, I think that the message should be more like
> "Input was not positive definite".
> For a pivoting rank-revealing Cholesky, I think that the result should by
> "Input was not semi-positive definite" or "Input was positive semi-definite
> but had rank {}" depending on the three way test.
> The exceptions thrown should not be sub-classes of NumberIsTooSmallException
> because it is a matrix that is the problem and matrices are not numbers and
> do not have a total order.

I agree.  I don't think a single message is going to work.  Ted's
analysis is correct - what we are dealing with here is a property of
the whole matrix and certainly not a "too small number."  How we
determine that the property fails may be different for different
decomposition methods or other use cases (like how it works as an
operator, see discussion here [1]).  I think the best thing to do is
to drop the member fields from the exception (because their meaning
is ambiguous, as more or less agreed in [1]) and allow the different
activations of the exception to customize the message (as in Ted's
second example above) or to include no message (appropriate in Ted's
first example).  I also think we should be more precise in the
exception itself whether it is strict or semi, probably by defining
a different exception for positive semi-definite failure.  IIRC, we
now use the same exception for both kinds of failure.



> On Fri, Sep 9, 2011 at 4:39 AM, Gilles Sadowski <
>> wrote:
>>> "Non-positive definiteness in input detected at diagonal element number
>> xxx"
>> What do you think of the following message?
>> <element value> is smaller than, or equal to, the minimum (<threshold
>> value>):
>> not positive definite matrix: value <element value> at index <element
>> index>
>> where, in actual messages, the <...> will be the numeric values of course.
>> "NonPositiveDefiniteMatrixException" would inherit from
>> "NumberIsTooSmallException". The rationale being that it exactly matches
>> the
>> test and that it is meaningless to report an element of the original
>> matrix,
>> as you've explained.
>>> [...]
>> Gilles
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message