You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by lu...@free.fr on 2011/09/19 10:15:50 UTC

Re: svn commit: r1172473 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear: FieldDecompositionSolver.java FieldLUDecompositionImpl.java

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


Re: svn commit: r1172473 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear: FieldDecompositionSolver.java FieldLUDecompositionImpl.java

Posted by Sébastien Brisard <se...@m4x.org>.
Hi Luc,
thanks for this message.
I'm so sorry about this. In fact I intended to remove the lines, and
forgot about it. Will do it and commit again.
Sébastien

2011/9/19  <lu...@free.fr>:
> 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
>
>

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