commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: svn commit: r1145101 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
Date Mon, 11 Jul 2011 14:18:25 GMT
On 7/11/11 3:01 AM, erans@apache.org wrote:
> Author: erans
> Date: Mon Jul 11 10:01:39 2011
> New Revision: 1145101
>
> URL: http://svn.apache.org/viewvc?rev=1145101&view=rev
> Log:
> Using "copyOf" from "MathUtils".

Doh!  Forgot we had that.  Thanks, Gilles!

Phil
> Modified:
>     commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
>
> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java?rev=1145101&r1=1145100&r2=1145101&view=diff
> ==============================================================================
> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
(original)
> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
Mon Jul 11 10:01:39 2011
> @@ -19,6 +19,7 @@ package org.apache.commons.math.stat.reg
>  import java.io.Serializable;
>  import java.util.Arrays;
>  import org.apache.commons.math.util.FastMath;
> +import org.apache.commons.math.util.MathUtils;
>  
>  /**
>   * Results of a Multiple Linear Regression model fit.
> @@ -65,12 +66,10 @@ public class RegressionResults implement
>              final boolean containsConstant,
>              final boolean copyData) {
>          if (copyData) {
> -            this.parameters = new double[parameters.length];
> -            System.arraycopy(parameters, 0, this.parameters, 0, parameters.length);
> +            this.parameters = MathUtils.copyOf(parameters);
>              this.varCovData = new double[varcov.length][];
>              for (int i = 0; i < varcov.length; i++) {
> -                this.varCovData[i] = new double[varcov[i].length];
> -                System.arraycopy(varcov[i], 0, this.varCovData[i], 0, varcov[i].length);
> +                this.varCovData[i] = MathUtils.copyOf(varcov[i]);
>              }
>          } else {
>              this.parameters = parameters;
> @@ -137,9 +136,7 @@ public class RegressionResults implement
>          if (this.parameters == null) {
>              return null;
>          }
> -        double[] out = new double[parameters.length];
> -        System.arraycopy(parameters, 0, out, 0, parameters.length);
> -        return out;
> +        return MathUtils.copyOf(parameters);
>      }
>  
>      /**
>
>
>


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


Mime
View raw message