commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From luc.maison...@free.fr
Subject Re: svn commit: r1172473 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear: FieldDecompositionSolver.java FieldLUDecompositionImpl.java
Date Mon, 19 Sep 2011 08:15:50 GMT
Hi S├ębastien,

----- Mail original -----
> Author: celestin
> Date: Mon Sep 19 06:19:36 2011
> New Revision: 1172473
> 
> URL: http://svn.apache.org/viewvc?rev=1172473&view=rev
> Log:
> Removed FieldDecompositionSolver<T>.solve(T[]). This is in accordance
> with JIRA MATH-661.
> 
> Modified:
>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
> 
> Modified:
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java?rev=1172473&r1=1172472&r2=1172473&view=diff
> ==============================================================================
> ---
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
> (original)
> +++
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
> Mon Sep 19 06:19:36 2011
> @@ -47,7 +47,7 @@ public interface FieldDecompositionSolve
>       * @throws SingularMatrixException
>       * if the decomposed matrix is singular.
>       */
> -    T[] solve(final T[] b);
> +    //T[] solve(final T[] b);

Rather than commenting out code, you can safely delete the corresponding lines.
If we change our mind and want to revive them, we can retrieve them using subversion.

best regards,
Luc


>  
>      /** Solve the linear equation A &times; X = B for matrices A.
>       * <p>The A matrix is implicit, it is provided by the underlying
> 
> Modified:
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java?rev=1172473&r1=1172472&r2=1172473&view=diff
> ==============================================================================
> ---
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
> (original)
> +++
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
> Mon Sep 19 06:19:36 2011
> @@ -253,45 +253,6 @@ public class FieldLUDecompositionImpl<T
>          }
>  
>          /** {@inheritDoc} */
> -        public T[] solve(T[] b) {
> -            final int m = pivot.length;
> -            if (b.length != m) {
> -                throw new DimensionMismatchException(b.length, m);
> -            }
> -            if (singular) {
> -                throw new SingularMatrixException();
> -            }
> -
> -            @SuppressWarnings("unchecked") // field is of type T
> -            final T[] bp = (T[])
> Array.newInstance(field.getZero().getClass(), m);
> -
> -            // Apply permutations to b
> -            for (int row = 0; row < m; row++) {
> -                bp[row] = b[pivot[row]];
> -            }
> -
> -            // Solve LY = b
> -            for (int col = 0; col < m; col++) {
> -                final T bpCol = bp[col];
> -                for (int i = col + 1; i < m; i++) {
> -                    bp[i] =
> bp[i].subtract(bpCol.multiply(lu[i][col]));
> -                }
> -            }
> -
> -            // Solve UX = Y
> -            for (int col = m - 1; col >= 0; col--) {
> -                bp[col] = bp[col].divide(lu[col][col]);
> -                final T bpCol = bp[col];
> -                for (int i = 0; i < col; i++) {
> -                    bp[i] =
> bp[i].subtract(bpCol.multiply(lu[i][col]));
> -                }
> -            }
> -
> -            return bp;
> -
> -        }
> -
> -        /** {@inheritDoc} */
>          public FieldVector<T> solve(FieldVector<T> b) {
>              try {
>                  return solve((ArrayFieldVector<T>) b);
> @@ -343,7 +304,42 @@ public class FieldLUDecompositionImpl<T
>           * @throws SingularMatrixException if the decomposed matrix
>           is singular.
>           */
>          public ArrayFieldVector<T> solve(ArrayFieldVector<T> b) {
> -            return new ArrayFieldVector<T>(field,
> solve(b.getDataRef()), false);
> +            final int m = pivot.length;
> +            if (b.data.length != m) {
> +                throw new DimensionMismatchException(b.data.length,
> m);
> +            }
> +            if (singular) {
> +                throw new SingularMatrixException();
> +            }
> +
> +            @SuppressWarnings("unchecked")
> +            // field is of type T
> +            final T[] bp = (T[])
> Array.newInstance(field.getZero().getClass(),
> +                                                   m);
> +
> +            // Apply permutations to b
> +            for (int row = 0; row < m; row++) {
> +                bp[row] = b.data[pivot[row]];
> +            }
> +
> +            // Solve LY = b
> +            for (int col = 0; col < m; col++) {
> +                final T bpCol = bp[col];
> +                for (int i = col + 1; i < m; i++) {
> +                    bp[i] =
> bp[i].subtract(bpCol.multiply(lu[i][col]));
> +                }
> +            }
> +
> +            // Solve UX = Y
> +            for (int col = m - 1; col >= 0; col--) {
> +                bp[col] = bp[col].divide(lu[col][col]);
> +                final T bpCol = bp[col];
> +                for (int i = 0; i < col; i++) {
> +                    bp[i] =
> bp[i].subtract(bpCol.multiply(lu[i][col]));
> +                }
> +            }
> +
> +            return new ArrayFieldVector<T>(bp, false);
>          }
>  
>          /** {@inheritDoc} */
> 
> 
> 

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


Mime
View raw message