You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles Sadowski (Jira)" <ji...@apache.org> on 2022/05/18 11:01:00 UTC
[jira] [Commented] (MATH-1646) PreconditionedIterativeLinearSolver.solve() not throwing proper NullArgumentException
[ https://issues.apache.org/jira/browse/MATH-1646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17538737#comment-17538737 ]
Gilles Sadowski commented on MATH-1646:
---------------------------------------
From {{PreconditionedIterativeLinearSolver.java}} (at line 76) in the "master" branch (development for the upcoming v4.0):
{code}
* @param m the preconditioner, M (can be {@code null})
{code}
> PreconditionedIterativeLinearSolver.solve() not throwing proper NullArgumentException
> -------------------------------------------------------------------------------------
>
> Key: MATH-1646
> URL: https://issues.apache.org/jira/browse/MATH-1646
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.6.1
> Reporter: Elia Bertolina
> Priority: Major
>
> PreconditionedIterativeLinearSolver.solve(RealLinearOperator a, RealLinearOperator m,RealVector b, RealVector x0) does not throw a NullArgumentException when one of the parameters is null.In the documentation it is stated that an NullArgumentException will be thrown if any of the parameters is null.
> However, in this test case:
>
> {code:java}
> public class PreconditionedIterativeLinearSolver_failure_Test {
> public void test() throws Throwable {
> Array2DRowRealMatrix array2DRowRealMatrix =
> new Array2DRowRealMatrix();
> ConjugateGradient conjugateGradient =
> new ConjugateGradient(49, 49, true);
> ArrayRealVector arrayRealVector = new ArrayRealVector();
> try {
> RealVector realVector = conjugateGradient.solve(
> (RealLinearOperator) array2DRowRealMatrix,
> (RealLinearOperator) null,
> (RealVector) arrayRealVector,
> (RealVector) arrayRealVector);
> org.junit.Assert.fail();
> }
> catch
> (org.apache.commons.math3.exception.NullArgumentException e){
> //Exception caught and test successful
> }
> }
> }{code}
>
> The second RealLinearOperator parameter is null and a NullArgumentException should be thrown, however the method executes normally, and test case fails.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)