commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Brisard <sebastien.bris...@m4x.org>
Subject Re: svn commit: r1178306 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/exception/util/ main/java/org/apache/commons/math/linear/ test/java/org/apache/commons/math/linear/
Date Mon, 03 Oct 2011 08:14:41 GMT
2011/10/3  <luc.maisonobe@free.fr>:
> Hi Sébastien,
>
> ----- Mail original -----
>> Author: celestin
>> Date: Mon Oct  3 06:33:21 2011
>> New Revision: 1178306
>>
>> URL: http://svn.apache.org/viewvc?rev=1178306&view=rev
>> Log:
>> - Replaced LinearOperator with Operator in exception names in order
>> to make them shorter (as discussed on the ML).
>> - Created IllConditionedOperatorException.
>> - Created SingularOperatorException (as discussed on the ML).
>>
>> Added:
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IllConditionedOperatorException.java
>>       (with props)
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteOperatorException.java
>>       - copied, changed from r1178288,
>>       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/NonSelfAdjointOperatorException.java
>>       - copied, changed from r1178288,
>>       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/NonSquareOperatorException.java
>>       - copied, changed from r1178288,
>>       commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularOperatorException.java
>>       (with props)
>> Removed:
>>     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/NonSquareLinearOperatorException.java
>> Modified:
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
>
>
> Could you also update the French translations in src/main/ressources/META-INF/localization
when you change some
> parts of Localizedformats enumerate ?
>
Done in revision 1178328.
> Thanks
>
> Luc
>
Thank *you* for reminding me.
Sébastien
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ConjugateGradient.java
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IterativeLinearSolver.java
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/JacobiPreconditioner.java
>>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/PreconditionedIterativeLinearSolver.java
>>     commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ConjugateGradientTest.java
>>
>> 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=1178306&r1=1178305&r2=1178306&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
>> Mon Oct  3 06:33:21 2011
>> @@ -110,6 +110,7 @@ public enum LocalizedFormats implements
>>      GCD_OVERFLOW_64_BITS("overflow: gcd({0}, {1}) is 2^63"),
>>      HOLE_BETWEEN_MODELS_TIME_RANGES("{0} wide hole between models
>>      time ranges"),
>>      IDENTICAL_ABSCISSAS_DIVISION_BY_ZERO("identical abscissas x[{0}]
>>      == x[{1}] == {2} cause division by zero"),
>> +    ILL_CONDITIONED_OPERATOR("condition number {1} is too high "),
>>      INDEX_LARGER_THAN_MAX("the index specified: {0} is larger than
>>      the current maximal index {1}"),
>>      INDEX_NOT_POSITIVE("index ({0}) is not positive"),
>>      INDEX_OUT_OF_RANGE("index {0} out of allowed range [{1}, {2}]"),
>> @@ -188,9 +189,9 @@ public enum LocalizedFormats implements
>>      NOT_POSITIVE_COLUMNDIMENSION("invalid column dimension: {0}
>>      (must be positive)"),
>>      NOT_POSITIVE_DEFINITE_MATRIX("not positive definite matrix"), /*
>>      keep */
>>      NON_POSITIVE_DEFINITE_MATRIX("not positive definite matrix:
>>      diagonal element at ({1},{1}) is smaller than {2} ({0})"),
>> -    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 */
>> +    NON_POSITIVE_DEFINITE_OPERATOR("non positive definite linear
>> operator"), /* keep */
>> +    NON_SELF_ADJOINT_OPERATOR("non self-adjoint linear operator"),
>> /* keep */
>> +    NON_SQUARE_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}"),
>> @@ -294,6 +295,7 @@ public enum LocalizedFormats implements
>>      SIMPLEX_NEED_ONE_POINT("simplex must contain at least one
>>      point"),
>>      SIMPLE_MESSAGE("{0}"),
>>      SINGULAR_MATRIX("matrix is singular"), /* keep */
>> +    SINGULAR_OPERATOR("operator is singular"),
>>      SUBARRAY_ENDS_AFTER_ARRAY_END("subarray ends after array end"),
>>      TOO_LARGE_CUTOFF_SINGULAR_VALUE("cutoff singular value is {0},
>>      should be at most {1}"),
>>      TOO_MANY_ELEMENTS_TO_DISCARD_FROM_ARRAY("cannot discard {0}
>>      elements from a {1} elements array"),
>>
>> Modified:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ConjugateGradient.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ConjugateGradient.java?rev=1178306&r1=1178305&r2=1178306&view=diff
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ConjugateGradient.java
>> (original)
>> +++
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ConjugateGradient.java
>> Mon Oct  3 06:33:21 2011
>> @@ -47,7 +47,7 @@ import org.apache.commons.math.util.Iter
>>   * <h3><a id="context">Exception context</a></h3>
>>   * <p>
>>   * Besides standard {@link DimensionMismatchException}, this class
>>   might throw
>> - * {@link NonPositiveDefiniteLinearOperatorException} if the linear
>> operator or
>> + * {@link NonPositiveDefiniteOperatorException} if the linear
>> operator or
>>   * the preconditioner are not positive definite. In this case, the
>>   * {@link ExceptionContext} provides some more information
>>   * <ul>
>> @@ -166,7 +166,7 @@ public class ConjugateGradient
>>      public RealVector solveInPlace(final RealLinearOperator a,
>>                                     final
>>                                     InvertibleRealLinearOperator
m,
>>                                     final RealVector b, final
>>                                     RealVector x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          checkParameters(a, m, b, x0);
>>          final IterationManager manager = getIterationManager();
>> @@ -219,8 +219,8 @@ public class ConjugateGradient
>>              }
>>              final double rhoNext = r.dotProduct(z);
>>              if (check && (rhoNext <= 0.)) {
>> -                final NonPositiveDefiniteLinearOperatorException e;
>> -                e = new
>> NonPositiveDefiniteLinearOperatorException();
>> +                final NonPositiveDefiniteOperatorException e;
>> +                e = new NonPositiveDefiniteOperatorException();
>>                  final ExceptionContext context = e.getContext();
>>                  context.setValue(OPERATOR, m);
>>                  context.setValue(VECTOR, r);
>> @@ -235,8 +235,8 @@ public class ConjugateGradient
>>              manager.incrementIterationCount();
>>              final double pq = p.dotProduct(q);
>>              if (check && (pq <= 0.)) {
>> -                final NonPositiveDefiniteLinearOperatorException e;
>> -                e = new
>> NonPositiveDefiniteLinearOperatorException();
>> +                final NonPositiveDefiniteOperatorException e;
>> +                e = new NonPositiveDefiniteOperatorException();
>>                  final ExceptionContext context = e.getContext();
>>                  context.setValue(OPERATOR, a);
>>                  context.setValue(VECTOR, p);
>>
>> Added:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IllConditionedOperatorException.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IllConditionedOperatorException.java?rev=1178306&view=auto
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IllConditionedOperatorException.java
>> (added)
>> +++
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IllConditionedOperatorException.java
>> Mon Oct  3 06:33:21 2011
>> @@ -0,0 +1,43 @@
>> +/*
>> + * 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.MathIllegalArgumentException;
>> +import org.apache.commons.math.exception.util.LocalizedFormats;
>> +
>> +/**
>> + * An exception to be thrown when the condition number of a
>> + * {@link RealLinearOperator} is too high.
>> + *
>> + * @version $Id$
>> + * @since 3.0
>> + */
>> +public class IllConditionedOperatorException
>> +    extends MathIllegalArgumentException {
>> +    /** Serializable version Id. */
>> +    private static final long serialVersionUID =
>> -7883263944530490135L;
>> +
>> +    /**
>> +     * Creates a new instance of this class.
>> +     *
>> +     * @param cond An estimate of the condition number of the
>> offending linear
>> +     * operator.
>> +     */
>> +    public IllConditionedOperatorException(final double cond) {
>> +        super(LocalizedFormats.ILL_CONDITIONED_OPERATOR, cond);
>> +    }
>> +}
>>
>> Propchange:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IllConditionedOperatorException.java
>> ------------------------------------------------------------------------------
>>     svn:eol-style = native
>>
>> Propchange:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IllConditionedOperatorException.java
>> ------------------------------------------------------------------------------
>>     svn:keywords = Author Date Id Revision
>>
>> Modified:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IterativeLinearSolver.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IterativeLinearSolver.java?rev=1178306&r1=1178305&r2=1178306&view=diff
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IterativeLinearSolver.java
>> (original)
>> +++
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/IterativeLinearSolver.java
>> Mon Oct  3 06:33:21 2011
>> @@ -67,20 +67,20 @@ public abstract class IterativeLinearSol
>>       * @param b Right-hand side vector.
>>       * @param x0 Initial guess of the solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} is not
>> square.
>> +     * @throws NonSquareOperatorException if {@code a} is not
>> square.
>>       * @throws DimensionMismatchException if {@code b} or {@code x0}
>>       have
>>       * dimensions inconsistent with {@code a}.
>>       */
>>      protected static void checkParameters(final RealLinearOperator
>>      a,
>>                                            final RealVector
b,
>>                                            final RealVector
x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException {
>>          MathUtils.checkNotNull(a);
>>          MathUtils.checkNotNull(b);
>>          MathUtils.checkNotNull(x0);
>>          if (a.getRowDimension() != a.getColumnDimension()) {
>> -            throw new
>> NonSquareLinearOperatorException(a.getRowDimension(),
>> +            throw new
>> NonSquareOperatorException(a.getRowDimension(),
>>                                                      
  a.getColumnDimension());
>>          }
>>          if (b.getDimension() != a.getRowDimension()) {
>> @@ -110,7 +110,7 @@ public abstract class IterativeLinearSol
>>       * @param b Right-hand side vector.
>>       * @return A new vector containing the solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} is not
>> square.
>> +     * @throws NonSquareOperatorException if {@code a} is not
>> square.
>>       * @throws DimensionMismatchException if {@code b} has
>>       dimensions
>>       * inconsistent with {@code a}.
>>       * @throws MaxCountExceededException at exhaustion of the
>>       iteration count,
>> @@ -118,7 +118,7 @@ public abstract class IterativeLinearSol
>>       * construction.
>>       */
>>      public RealVector solve(RealLinearOperator a, RealVector b)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          MathUtils.checkNotNull(a);
>>          final RealVector x = new
>>          ArrayRealVector(a.getColumnDimension());
>> @@ -135,7 +135,7 @@ public abstract class IterativeLinearSol
>>       * @param x0 Initial guess of the solution.
>>       * @return A new vector containing the solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} is not
>> square.
>> +     * @throws NonSquareOperatorException if {@code a} is not
>> square.
>>       * @throws DimensionMismatchException if {@code b} or {@code x0}
>>       have
>>       * dimensions inconsistent with {@code a}.
>>       * @throws MaxCountExceededException at exhaustion of the
>>       iteration count,
>> @@ -143,7 +143,7 @@ public abstract class IterativeLinearSol
>>       * construction.
>>       */
>>      public RealVector solve(RealLinearOperator a, RealVector b,
>>      RealVector x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          MathUtils.checkNotNull(x0);
>>          return solveInPlace(a, b, x0.copy());
>> @@ -159,7 +159,7 @@ public abstract class IterativeLinearSol
>>       * @return A reference to {@code x0} (shallow copy) updated with
>>       the
>>       * solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} is not
>> square.
>> +     * @throws NonSquareOperatorException if {@code a} is not
>> square.
>>       * @throws DimensionMismatchException if {@code b} or {@code x0}
>>       have
>>       * dimensions inconsistent with {@code a}.
>>       * @throws MaxCountExceededException at exhaustion of the
>>       iteration count,
>> @@ -168,6 +168,6 @@ public abstract class IterativeLinearSol
>>       */
>>      public abstract RealVector solveInPlace(RealLinearOperator a,
>>      RealVector b,
>>                                              RealVector x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException;
>>  }
>>
>> Modified:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/JacobiPreconditioner.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/JacobiPreconditioner.java?rev=1178306&r1=1178305&r2=1178306&view=diff
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/JacobiPreconditioner.java
>> (original)
>> +++
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/JacobiPreconditioner.java
>> Mon Oct  3 06:33:21 2011
>> @@ -50,13 +50,13 @@ public class JacobiPreconditioner
>>       * @param a Linear operator for which the preconditioner should
>>       be built.
>>       * @return Preconditioner made of the diagonal coefficients of
>>       the specified
>>       *         linear operator.
>> -     * @throws NonSquareLinearOperatorException if {@code a} is not
>> square.
>> +     * @throws NonSquareOperatorException if {@code a} is not
>> square.
>>       */
>>      public static JacobiPreconditioner create(final
>>      RealLinearOperator a)
>> -        throws NonSquareLinearOperatorException {
>> +        throws NonSquareOperatorException {
>>          final int n = a.getColumnDimension();
>>          if (a.getRowDimension() != n) {
>> -            throw new
>> NonSquareLinearOperatorException(a.getRowDimension(), n);
>> +            throw new
>> NonSquareOperatorException(a.getRowDimension(), n);
>>          }
>>          final double[] diag = new double[n];
>>          if (a instanceof AbstractRealMatrix) {
>>
>> Copied:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteOperatorException.java
>> (from r1178288,
>> 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/NonPositiveDefiniteOperatorException.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteOperatorException.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonPositiveDefiniteLinearOperatorException.java&r1=1178288&r2=1178306&rev=1178306&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/NonPositiveDefiniteOperatorException.java
>> Mon Oct  3 06:33:21 2011
>> @@ -32,10 +32,13 @@ import org.apache.commons.math.exception
>>   * @version $Id$
>>   * @since 3.0
>>   */
>> -public class NonPositiveDefiniteLinearOperatorException
>> +public class NonPositiveDefiniteOperatorException
>>      extends MathIllegalArgumentException {
>> +    /** Serializable version Id. */
>> +    private static final long serialVersionUID =
>> 917034489420549847L;
>> +
>>      /** Creates a new instance of this class. */
>> -    public NonPositiveDefiniteLinearOperatorException() {
>> -
>>        super(LocalizedFormats.NON_POSITIVE_DEFINITE_LINEAR_OPERATOR);
>> +    public NonPositiveDefiniteOperatorException() {
>> +        super(LocalizedFormats.NON_POSITIVE_DEFINITE_OPERATOR);
>>      }
>>  }
>>
>> Copied:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointOperatorException.java
>> (from r1178288,
>> 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/NonSelfAdjointOperatorException.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointOperatorException.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSelfAdjointLinearOperatorException.java&r1=1178288&r2=1178306&rev=1178306&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/NonSelfAdjointOperatorException.java
>> Mon Oct  3 06:33:21 2011
>> @@ -35,11 +35,13 @@ import org.apache.commons.math.exception
>>   * @version $Id$
>>   * @since 3.0
>>   */
>> -public class NonSelfAdjointLinearOperatorException
>> +public class NonSelfAdjointOperatorException
>>      extends MathIllegalArgumentException {
>> +    /** Serializable version Id. */
>> +    private static final long serialVersionUID =
>> 1784999305030258247L;
>>
>>      /** Creates a new instance of this class. */
>> -    public NonSelfAdjointLinearOperatorException() {
>> -        super(LocalizedFormats.NON_SELF_ADJOINT_LINEAR_OPERATOR);
>> +    public NonSelfAdjointOperatorException() {
>> +        super(LocalizedFormats.NON_SELF_ADJOINT_OPERATOR);
>>      }
>>  }
>>
>> Copied:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareOperatorException.java
>> (from r1178288,
>> 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/NonSquareOperatorException.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareOperatorException.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java&r1=1178288&r2=1178306&rev=1178306&view=diff
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareLinearOperatorException.java
>> (original)
>> +++
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NonSquareOperatorException.java
>> Mon Oct  3 06:33:21 2011
>> @@ -25,9 +25,9 @@ import org.apache.commons.math.exception
>>   * @since 3.0
>>   * @version $Id$
>>   */
>> -public class NonSquareLinearOperatorException extends
>> DimensionMismatchException {
>> +public class NonSquareOperatorException extends
>> DimensionMismatchException {
>>      /** Serializable version Id. */
>> -    private static final long serialVersionUID =
>> -660069396594485772L;
>> +    private static final long serialVersionUID =
>> -4145007524150846242L;
>>
>>      /**
>>       * Construct an exception from the mismatched dimensions.
>> @@ -35,7 +35,7 @@ public class NonSquareLinearOperatorExce
>>       * @param wrong Row dimension.
>>       * @param expected Column dimension.
>>       */
>> -    public NonSquareLinearOperatorException(int wrong, int expected)
>> {
>> -        super(LocalizedFormats.NON_SQUARE_LINEAR_OPERATOR, wrong,
>> expected);
>> +    public NonSquareOperatorException(int wrong, int expected) {
>> +        super(LocalizedFormats.NON_SQUARE_OPERATOR, wrong,
>> expected);
>>      }
>>  }
>>
>> Modified:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/PreconditionedIterativeLinearSolver.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/PreconditionedIterativeLinearSolver.java?rev=1178306&r1=1178305&r2=1178306&view=diff
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/PreconditionedIterativeLinearSolver.java
>> (original)
>> +++
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/PreconditionedIterativeLinearSolver.java
>> Mon Oct  3 06:33:21 2011
>> @@ -66,7 +66,7 @@ public abstract class PreconditionedIter
>>       * @param x0 Initial guess of the solution.
>>       * @return A new vector containing the solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} or
>> {@code m} is not
>> +     * @throws NonSquareOperatorException if {@code a} or {@code m}
>> is not
>>       * square.
>>       * @throws DimensionMismatchException if {@code m}, {@code b} or
>>       {@code x0}
>>       * have dimensions inconsistent with {@code a}.
>> @@ -77,7 +77,7 @@ public abstract class PreconditionedIter
>>      public RealVector solve(final RealLinearOperator a,
>>                              final InvertibleRealLinearOperator m,
>>                              final RealVector b, final RealVector
x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          MathUtils.checkNotNull(x0);
>>          return solveInPlace(a, m, b, x0.copy());
>> @@ -86,7 +86,7 @@ public abstract class PreconditionedIter
>>      /** {@inheritDoc} */
>>      @Override
>>      public RealVector solve(final RealLinearOperator a, final
>>      RealVector b)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          MathUtils.checkNotNull(a);
>>          final RealVector x = new
>>          ArrayRealVector(a.getColumnDimension());
>> @@ -98,7 +98,7 @@ public abstract class PreconditionedIter
>>      @Override
>>      public RealVector solve(final RealLinearOperator a, final
>>      RealVector b,
>>                              final RealVector x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          MathUtils.checkNotNull(x0);
>>          return solveInPlace(a, null, b, x0.copy());
>> @@ -116,7 +116,7 @@ public abstract class PreconditionedIter
>>       * @param b Right-hand side vector.
>>       * @param x0 Initial guess of the solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} or
>> {@code m} is not
>> +     * @throws NonSquareOperatorException if {@code a} or {@code m}
>> is not
>>       * square.
>>       * @throws DimensionMismatchException if {@code m}, {@code b} or
>>       {@code x0}
>>       * have dimensions inconsistent with {@code a}.
>> @@ -125,12 +125,12 @@ public abstract class PreconditionedIter
>>                                            final
>>                                            InvertibleRealLinearOperator
>>                                            m,
>>                                            final RealVector
b,
>>                                            final RealVector
x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException {
>>          checkParameters(a, b, x0);
>>          if (m != null) {
>>              if (m.getColumnDimension() != m.getRowDimension()) {
>> -                throw new
>> NonSquareLinearOperatorException(m.getColumnDimension(),
>> +                throw new
>> NonSquareOperatorException(m.getColumnDimension(),
>>                                                      
      m.getRowDimension());
>>              }
>>              if (m.getRowDimension() != a.getRowDimension()) {
>> @@ -149,7 +149,7 @@ public abstract class PreconditionedIter
>>       * @param b Right-hand side vector.
>>       * @return A new vector containing the solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} or
>> {@code m} is not
>> +     * @throws NonSquareOperatorException if {@code a} or {@code m}
>> is not
>>       * square.
>>       * @throws DimensionMismatchException if {@code m} or {@code b}
>>       have
>>       * dimensions inconsistent with {@code a}.
>> @@ -159,7 +159,7 @@ public abstract class PreconditionedIter
>>       */
>>      public RealVector solve(RealLinearOperator a,
>>                              InvertibleRealLinearOperator m,
>>                              RealVector b)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          MathUtils.checkNotNull(a);
>>          final RealVector x = new
>>          ArrayRealVector(a.getColumnDimension());
>> @@ -177,7 +177,7 @@ public abstract class PreconditionedIter
>>       * @return A reference to {@code x0} (shallow copy) updated with
>>       the
>>       * solution.
>>       * @throws NullArgumentException if one of the parameters is
>>       {@code null}.
>> -     * @throws NonSquareLinearOperatorException if {@code a} or
>> {@code m} is not
>> +     * @throws NonSquareOperatorException if {@code a} or {@code m}
>> is not
>>       * square.
>>       * @throws DimensionMismatchException if {@code m}, {@code b} or
>>       {@code x0}
>>       * have dimensions inconsistent with {@code a}.
>> @@ -188,14 +188,14 @@ public abstract class PreconditionedIter
>>      public abstract RealVector solveInPlace(RealLinearOperator a,
>>                                              InvertibleRealLinearOperator
>>                                              m,
>>                                              RealVector b,
RealVector
>>                                              x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException;
>>
>>      /** {@inheritDoc} */
>>      @Override
>>      public RealVector solveInPlace(final RealLinearOperator a,
>>                                     final RealVector b, final
>>                                     RealVector x0)
>> -        throws NullArgumentException,
>> NonSquareLinearOperatorException,
>> +        throws NullArgumentException, NonSquareOperatorException,
>>          DimensionMismatchException, MaxCountExceededException {
>>          return solveInPlace(a, null, b, x0);
>>      }
>>
>> Added:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularOperatorException.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularOperatorException.java?rev=1178306&view=auto
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularOperatorException.java
>> (added)
>> +++
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularOperatorException.java
>> Mon Oct  3 06:33:21 2011
>> @@ -0,0 +1,39 @@
>> +/*
>> + * 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.MathIllegalArgumentException;
>> +import org.apache.commons.math.exception.util.LocalizedFormats;
>> +
>> +/**
>> + * Exception to be thrown when trying to invert a singular operator.
>> + *
>> + * @version $Id$
>> + * @since 3.0
>> + */
>> +public class SingularOperatorException
>> +    extends MathIllegalArgumentException {
>> +    /** Serializable version Id. */
>> +    private static final long serialVersionUID =
>> -476049978595245033L;
>> +
>> +    /**
>> +     * Creates a new instance of this class.
>> +     */
>> +    public SingularOperatorException() {
>> +        super(LocalizedFormats.SINGULAR_OPERATOR);
>> +    }
>> +}
>>
>> Propchange:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularOperatorException.java
>> ------------------------------------------------------------------------------
>>     svn:eol-style = native
>>
>> Propchange:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularOperatorException.java
>> ------------------------------------------------------------------------------
>>     svn:keywords = Author Date Id Revision
>>
>> Modified:
>> commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ConjugateGradientTest.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ConjugateGradientTest.java?rev=1178306&r1=1178305&r2=1178306&view=diff
>> ==============================================================================
>> ---
>> commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ConjugateGradientTest.java
>> (original)
>> +++
>> commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ConjugateGradientTest.java
>> Mon Oct  3 06:33:21 2011
>> @@ -25,7 +25,7 @@ import org.junit.Test;
>>
>>  public class ConjugateGradientTest {
>>
>> -    @Test(expected = NonSquareLinearOperatorException.class)
>> +    @Test(expected = NonSquareOperatorException.class)
>>      public void testNonSquareOperator() {
>>          final Array2DRowRealMatrix a = new Array2DRowRealMatrix(2,
>>          3);
>>          final IterativeLinearSolver solver;
>> @@ -55,7 +55,7 @@ public class ConjugateGradientTest {
>>          solver.solve(a, b, x);
>>      }
>>
>> -    @Test(expected =
>> NonPositiveDefiniteLinearOperatorException.class)
>> +    @Test(expected = NonPositiveDefiniteOperatorException.class)
>>      public void testNonPositiveDefiniteLinearOperator() {
>>          final Array2DRowRealMatrix a = new Array2DRowRealMatrix(2,
>>          2);
>>          a.setEntry(0, 0, -1.);
>> @@ -199,7 +199,7 @@ public class ConjugateGradientTest {
>>          }
>>      }
>>
>> -    @Test(expected = NonSquareLinearOperatorException.class)
>> +    @Test(expected = NonSquareOperatorException.class)
>>      public void testNonSquarePreconditioner() {
>>          final Array2DRowRealMatrix a = new Array2DRowRealMatrix(2,
>>          2);
>>          final InvertibleRealLinearOperator m;
>> @@ -263,7 +263,7 @@ public class ConjugateGradientTest {
>>          solver.solve(a, m, b);
>>      }
>>
>> -    @Test(expected =
>> NonPositiveDefiniteLinearOperatorException.class)
>> +    @Test(expected = NonPositiveDefiniteOperatorException.class)
>>      public void testNonPositiveDefinitePreconditioner() {
>>          final Array2DRowRealMatrix a = new Array2DRowRealMatrix(2,
>>          2);
>>          a.setEntry(0, 0, 1d);
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message