commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1154361 - in /commons/proper/math/trunk/src/main: java/org/apache/commons/math/exception/util/ java/org/apache/commons/math/linear/ resources/META-INF/localization/
Date Fri, 05 Aug 2011 19:43:05 GMT
Author: erans
Date: Fri Aug  5 19:43:04 2011
New Revision: 1154361

URL: http://svn.apache.org/viewvc?rev=1154361&view=rev
Log:
MATH-581
New exception. Simplified others.

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java
  (with props)
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteLinearOperatorException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointLinearOperatorException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java
    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java?rev=1154361&r1=1154360&r2=1154361&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
Fri Aug  5 19:43:04 2011
@@ -172,7 +172,7 @@ public enum LocalizedFormats implements 
     NON_REAL_FINITE_ABSCISSA("all abscissae must be finite real numbers, but {0}-th is {1}"),
     NON_REAL_FINITE_ORDINATE("all ordinatae must be finite real numbers, but {0}-th is {1}"),
     NON_REAL_FINITE_WEIGHT("all weights must be finite real numbers, but {0}-th is {1}"),
-    NON_SQUARE_MATRIX("a {0}x{1} matrix was provided instead of a square matrix"),
+    NON_SQUARE_MATRIX("non square ({0}x{1}) matrix"),
     NORMALIZE_INFINITE("Cannot normalize to an infinite value"),
     NORMALIZE_NAN("Cannot normalize to NaN"),
     NOT_ADDITION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not addition compatible"),
@@ -188,8 +188,9 @@ public enum LocalizedFormats implements 
     NOT_POSITIVE_COLUMNDIMENSION("invalid column dimension: {0} (must be positive)"),
     NOT_POSITIVE_DEFINITE_MATRIX("not positive definite matrix"),
     NON_POSITIVE_DEFINITE_MATRIX("not positive definite matrix: diagonal element at ({0},{0})
is larger than {2}"), /* keep */
-    NON_POSITIVE_DEFINITE_LINEAR_OPERATOR("non positive definite linear operator: x' A x
<= 0 when x is {0}"),
-    NON_SELF_ADJOINT_LINEAR_OPERATOR("non self-adjoint linear operator: |x' A y - y' A x|
> {0} when x is {1} and y is {2}"),
+    NON_POSITIVE_DEFINITE_LINEAR_OPERATOR("non positive definite linear operator"), /* keep
*/
+    NON_SELF_ADJOINT_LINEAR_OPERATOR("non self-adjoint linear operator"), /* keep */
+    NON_SQUARE_LINEAR_OPERATOR("non square ({0}x{1}) linear operator"), /* keep */
     DEGREES_OF_FREEDOM("degrees of freedom ({0})"), /* keep */
     NOT_POSITIVE_DEGREES_OF_FREEDOM("degrees of freedom must be positive ({0})"),
     NOT_POSITIVE_ELEMENT_AT_INDEX("element {0} is not positive: {1}"),

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteLinearOperatorException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteLinearOperatorException.java?rev=1154361&r1=1154360&r2=1154361&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteLinearOperatorException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteLinearOperatorException.java
Fri Aug  5 19:43:04 2011
@@ -33,54 +33,8 @@ import org.apache.commons.math.exception
  */
 public class NonPositiveDefiniteLinearOperatorException
     extends MathIllegalArgumentException {
-    /** The offending linear operator.*/
-    private final RealLinearOperator a;
-    /** A reference to the offending vector. */
-    private final RealVector x;
-
-    /**
-     * Creates a new instance of this class.
-     *
-     * @param a Offending linear operator.
-     * @param x Offending vector.
-     */
-    public NonPositiveDefiniteLinearOperatorException(final RealLinearOperator a,
-                                                      final double[] x) {
-        this(a, new ArrayRealVector(x, false));
-    }
-
-    /**
-     * Creates a new instance of this class.
-     *
-     * @param a Offending linear operator.
-     * @param x Offending vector.
-     */
-    public NonPositiveDefiniteLinearOperatorException(final RealLinearOperator a,
-                                                      final RealVector x) {
-        super(LocalizedFormats.NON_POSITIVE_DEFINITE_LINEAR_OPERATOR, x);
-        this.a = a;
-        this.x = x;
-    }
-
-    /**
-     * Returns a reference to the offending vector.
-     * If the exception was raised by a call to
-     * {@link #NonPositiveDefiniteLinearOperatorException(RealLinearOperator,
-     * double[])}, then a new {@link ArrayRealVector} holding a reference to
-     * the actual {@code double[]} is returned.
-     *
-     * @return the offending vector.
-     */
-    public RealVector getOffendingVector() {
-        return x;
-    }
-
-    /**
-     * Returns a reference to the offending linear operator.
-     *
-     * @return the offending linear operator.
-     */
-    public RealLinearOperator getOffendingLinearOperator() {
-        return a;
+    /** Creates a new instance of this class. */
+    public NonPositiveDefiniteLinearOperatorException() {
+        super(LocalizedFormats.NON_POSITIVE_DEFINITE_LINEAR_OPERATOR);
     }
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointLinearOperatorException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointLinearOperatorException.java?rev=1154361&r1=1154360&r2=1154361&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointLinearOperatorException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointLinearOperatorException.java
Fri Aug  5 19:43:04 2011
@@ -36,93 +36,9 @@ import org.apache.commons.math.exception
  */
 public class NonSelfAdjointLinearOperatorException
     extends MathIllegalArgumentException {
-    /** The offending linear operator, A. */
-    private final RealLinearOperator a;
-    /** The threshold. */
-    private final double threshold;
-    /** A reference to the first offending vector*/
-    private final RealVector x;
-    /** A reference to the second offending vector*/
-    private final RealVector y;
 
-    /**
-     * Creates a new instance of this class.
-     *
-     * @param a Offending linear operator.
-     * @param x First offending vector.
-     * @param y Second offending vector.
-     * @param threshold Threshold.
-     */
-    public NonSelfAdjointLinearOperatorException(final RealLinearOperator a,
-                                                 final double[] x,
-                                                 final double[] y,
-                                                 final double threshold) {
-        this(a,
-             new ArrayRealVector(x, false),
-             new ArrayRealVector(y, false),
-             threshold);
-    }
-
-    /**
-     * Creates a new instance of this class.
-     *
-     * @param a Offending linear operator.
-     * @param x First offending vector.
-     * @param y Second offending vector.
-     * @param threshold Threshold.
-     */
-    public NonSelfAdjointLinearOperatorException(final RealLinearOperator a,
-                                                 final RealVector x,
-                                                 final RealVector y,
-                                                 final double threshold) {
-        super(LocalizedFormats.NON_SELF_ADJOINT_LINEAR_OPERATOR, threshold, x, y);
-        this.a = a;
-        this.x = x;
-        this.y = y;
-        this.threshold = threshold;
-    }
-
-    /**
-     * Returns a reference to the first offending vector.
-     * If the exception was raised by a call to
-     * {@link #NonSelfAdjointLinearOperatorException(RealLinearOperator,
-     * double[], double[], double)}, then a new {@link ArrayRealVector}
-     * holding a reference to the actual {@code double[]} is returned.
-     *
-     * @return the first offending vector.
-     */
-    public RealVector getFirstOffendingVector() {
-        return x;
-    }
-
-    /**
-     * Returns a reference to the offending linear operator.
-     *
-     * @return the offending linear operator.
-     */
-    public RealLinearOperator getOffendingLinearOperator() {
-        return a;
-    }
-
-    /**
-     * Returns a copy of the second offending vector.
-     * If the exception was raised by a call to
-     * {@link #NonSelfAdjointLinearOperatorException(RealLinearOperator,
-     * double[], double[], double)}, then a new {@link ArrayRealVector}
-     * holding a reference to the actual {@code double[]} is returned.
-     *
-     * @return the second offending vector.
-     */
-    public RealVector getSecondOffendingVector() {
-        return y;
-    }
-
-    /**
-     * Returns the threshold.
-     *
-     * @return the threshold.
-     */
-    public double getThreshold() {
-        return threshold;
+    /** Creates a new instance of this class. */
+    public NonSelfAdjointLinearOperatorException() {
+        super(LocalizedFormats.NON_SELF_ADJOINT_LINEAR_OPERATOR);
     }
 }

Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java?rev=1154361&view=auto
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java
(added)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java
Fri Aug  5 19:43:04 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.linear;
+
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.util.LocalizedFormats;
+
+/**
+ * Exception to be thrown when a square linear operator is expected.
+ *
+ * @since 3.0
+ * @version $Id$
+ */
+public class NonSquareLinearOperatorException extends DimensionMismatchException {
+    /** Serializable version Id. */
+    private static final long serialVersionUID = -660069396594485772L;
+
+    /**
+     * Construct an exception from the mismatched dimensions.
+     *
+     * @param wrong Row dimension.
+     * @param expected Column dimension.
+     */
+    public NonSquareLinearOperatorException(int wrong, int expected) {
+        super(LocalizedFormats.NON_SQUARE_LINEAR_OPERATOR, wrong, expected);
+    }
+}

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java?rev=1154361&r1=1154360&r2=1154361&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareMatrixException.java
Fri Aug  5 19:43:04 2011
@@ -26,7 +26,6 @@ import org.apache.commons.math.exception
  * @version $Id$
  */
 public class NonSquareMatrixException extends DimensionMismatchException {
-
     /** Serializable version Id. */
     private static final long serialVersionUID = -660069396594485772L;
 

Modified: commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties?rev=1154361&r1=1154360&r2=1154361&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
(original)
+++ commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
Fri Aug  5 19:43:04 2011
@@ -142,7 +142,7 @@ NON_POSITIVE_POLYNOMIAL_DEGREE = le poly
 NON_REAL_FINITE_ABSCISSA = toutes les abscisses doivent \u00eatre des nombres r\u00e9els
finis, mais l''abscisse {0} vaut {1}
 NON_REAL_FINITE_ORDINATE = toutes les ordonn\u00e9es doivent \u00eatre des nombres r\u00e9els
finis, mais l''ordonn\u00e9e {0} vaut {1}
 NON_REAL_FINITE_WEIGHT = tous les poids doivent \u00eatre des nombres r\u00e9els finis, mais
le poids {0} vaut {1}
-NON_SQUARE_MATRIX = une matrice {0}x{1} a \u00e9t\u00e9 fournie \u00e0 la place d''une matrice
carr\u00e9e
+NON_SQUARE_MATRIX = matrice non carr\u00e9e ({0}x{1})
 NORMALIZE_INFINITE = impossible de normaliser vers une valeur infinie
 NORMALIZE_NAN = impossible de normaliser vers NaN
 NOT_ADDITION_COMPATIBLE_MATRICES = les dimensions {0}x{1} et {2}x{3} sont incompatibles pour
l''addition matricielle
@@ -158,8 +158,10 @@ BETA = beta
 NOT_POSITIVE_COLUMNDIMENSION = nombre de colonnes invalide : {0} (doit \u00eatre positif)
 NOT_POSITIVE_DEFINITE_MATRIX = matrice non d\u00e9finie positive
 NON_POSITIVE_DEFINITE_MATRIX = matrice non d\u00e9finie positive: l''\u00e9l\u00e9ment diagonal
({0},{0}) est sup\u00e9rieur \u0061 {1}
-NON_POSITIVE_DEFINITE_LINEAR_OPERATOR = op\u00e9 lin\u00e9aire non d\u00e9fini positif: x''
A x <= 0 quand x est {0}
-NON_SELF_ADJOINT_LINEAR_OPERATOR = op\u00e9 lin\u00e9aire non auto-adjoint: |x'' A y - y''
A x| > {0} quand x est {1} et y est {2}
+NON_SELF_ADJOINT_LINEAR_OPERATOR = : |x'' A y - y'' A x| > {0} quand x est {1} et y est
{2}
+NON_POSITIVE_DEFINITE_LINEAR_OPERATOR = op\u00e9rateur lin\u00e9aire non d\u00e9fini positif
+NON_SELF_ADJOINT_LINEAR_OPERATOR = op\u00e9rateur lin\u00e9aire non auto-adjoint
+NON_SQUARE_LINEAR_OPERATOR = op\u00e9rateur lin\u00e9aire non carr\u00e9 ({0}x{1})
 NOT_POSITIVE_DEGREES_OF_FREEDOM = les degr\u00e9s de libert\u00e9 doivent \u00eatre positifs
({0})
 DEGREES_OF_FREEDOM = degr\u00e9s de libert\u00e9 ({0})
 NOT_POSITIVE_ELEMENT_AT_INDEX = l''\u00e9l\u00e9ment {0} n''est pas positif : {1}



Mime
View raw message