commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-195) Inconsistencies in the Exception hierarchy
Date Wed, 01 Sep 2010 16:27:57 GMT

    [ https://issues.apache.org/jira/browse/MATH-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12905077#action_12905077
] 

Luc Maisonobe commented on MATH-195:
------------------------------------

FunctionEvaluationException is mainly an exception designed for users functions, its often
not an exception commons-math creates by itself.
Numerous example are linked to solving a physical problem (say finding an energy level in
theoretical physics or  finding a spacecraft orbit that best fir a set of observations in
a flight dynamics problem). These user functions may not be computable at some points and
the general mathematical algorithm cannot know it beforehand. So when user code encounters
a problem, he must be able to raise an exception and commons-math must be able to stop in
this case.

Although since we currently do not have constrained optimization (except in the linear case),
we cannot prevent the general optimizing algorithm to wander outside of the user function
defining domain and hence violate users function precondition. So it would be difficult to
have a separate policy for preconditions and for other kinds of errors.

Changing FunctionEvaluatinException to unchecked may be a good move, but our algorithms should
document that these exceptions can arise if user code throws them.

> Inconsistencies in the Exception hierarchy
> ------------------------------------------
>
>                 Key: MATH-195
>                 URL: https://issues.apache.org/jira/browse/MATH-195
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1, 1.2, 2.0, Nightly Builds
>            Reporter: Thomas Chust
>            Assignee: Gilles
>            Priority: Minor
>             Fix For: 3.0
>
>   Original Estimate: 0.17h
>  Remaining Estimate: 0.17h
>
> I think there are some inconsistencies in the hierarchy of exceptions used by the Commons
Math library which could easily be fixed:
>   - org.apache.commons.math.linear.MatrixIndexException should really be a subclass of
>     java.lang.IndexOutOfBoundsException.
>   - Either org.apache.commons.math.linear.InvalidMatrixException should be checked or
>     org.apache.commons.math.random.NotPositiveDefiniteMatrixException and
>     org.apache.commons.math.geometry.NotARotationMatrixException should be unchecked,
but in any case the latter two
>     should be subclasses of the former. An unchecked InvalidMatrixException should probably
be a subclass of
>     java.lang.ArithmeticException while a checked InvalidMatrixException should be a
subclass of
>     org.apache.commons.math.MathException.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message