----- dim...@apache.org a écrit :

> Author: dimpbx
> Date: Sun Feb 21 21:46:12 2010
> New Revision: 912413
> 
> URL: http://svn.apache.org/viewvc?rev=912413&view=rev
> Log:
> MATH-432 fixed

The log should probably refer to MATH-342

Luc

> 
> Modified:
>    
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
>    
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
>     commons/proper/math/trunk/src/site/xdoc/changes.xml
> 
> Modified:
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java?rev=912413&r1=912412&r2=912413&view=diff
> ==============================================================================
> ---
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
> (original)
> +++
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
> Sun Feb 21 21:46:12 2010
> @@ -479,6 +479,29 @@
>          }
>          realEigenvalues[n - 1] = main[n - 1];
>          e[n - 1] = 0.0;
> +
> +        // Determine the largest main and secondary value in absolute
> term.
> +        double maxAbsoluteValue=0.0;
> +        for (int i = 0; i < n; i++) {
> +            if (Math.abs(realEigenvalues[i])>maxAbsoluteValue) {
> +                maxAbsoluteValue=Math.abs(realEigenvalues[i]);
> +            }
> +            if (Math.abs(e[i])>maxAbsoluteValue) {
> +                maxAbsoluteValue=Math.abs(e[i]);
> +            }
> +        }
> +        // Make null any main and secondary value too small to be
> significant
> +        if (maxAbsoluteValue!=0.0) {
> +            for (int i=0; i < n; i++) {
> +                if
> (Math.abs(realEigenvalues[i])<=MathUtils.EPSILON*maxAbsoluteValue) {
> +                    realEigenvalues[i]=0.0;
> +                }
> +                if
> (Math.abs(e[i])<=MathUtils.EPSILON*maxAbsoluteValue) {
> +                    e[i]=0.0;
> +                }
> +            }
> +        }
> +
>          for (int j = 0; j < n; j++) {
>              int its = 0;
>              int m;
> @@ -568,7 +591,7 @@
>          }
>  
>          // Determine the largest eigen value in absolute term.
> -        double maxAbsoluteValue=0.0;
> +        maxAbsoluteValue=0.0;
>          for (int i = 0; i < n; i++) {
>              if (Math.abs(realEigenvalues[i])>maxAbsoluteValue) {
>                  maxAbsoluteValue=Math.abs(realEigenvalues[i]);
> 
> Modified:
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java?rev=912413&r1=912412&r2=912413&view=diff
> ==============================================================================
> ---
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
> (original)
> +++
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
> Sun Feb 21 21:46:12 2010
> @@ -88,11 +88,12 @@
>          // create A^T*A
>          //
>          for (int i = 0; i < n; i++) {
> -            for (int j = 0; j < n; j++) {
> +            for (int j = i; j < n; j++) {
>                  matATA[i][j] = 0.0;
>                  for (int k = 0; k < m; k++) {
>                      matATA[i][j] += localcopy[k][i] *
> localcopy[k][j];
>                  }
> +                matATA[j][i]=matATA[i][j];
>              }
>          }
>  
> @@ -101,11 +102,12 @@
>          // create A*A^T
>          //
>          for (int i = 0; i < m; i++) {
> -            for (int j = 0; j < m; j++) {
> +            for (int j = i; j < m; j++) {
>                  matAAT[i][j] = 0.0;
>                  for (int k = 0; k < n; k++) {
>                      matAAT[i][j] += localcopy[i][k] *
> localcopy[j][k];
>                  }
> +                matAAT[j][i]=matAAT[i][j];
>              }
>          }
>          int p;
> 
> Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
> URL:
> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=912413&r1=912412&r2=912413&view=diff
> ==============================================================================
> --- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
> +++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Feb 21
> 21:46:12 2010
> @@ -39,6 +39,12 @@
>    </properties>
>    <body>
>      <release version="2.1" date="TBD" description="TBD">
> +      <action dev="dimpbx" type="fix" issue="MATH-342">
> +        In SVD, the matrices passed to EigenDecomposition are now
> symmetric
> +        by construction (rather than simply by definition).  In
> EigenDecomposition,
> +        once the tridiagonal form is obtained, the non-significant
> elements are
> +        set to 0.
> +      </action>
>        <action dev="dimpbx" type="fix" issue="MATH-333">
>          A EigenDecompositionImpl simplified makes it possible to
> compute
>          the SVD of a singular matrix (with the right number of
> elements in

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

Reply via email to