Hi Sébastien.

>  
>  /**
>   * Gauss-Newton least-squares solver.
> @@ -146,8 +148,13 @@ public class GaussNewtonOptimizer extend
>                  DecompositionSolver solver = useLU ?
>                          new LUDecompositionImpl(mA).getSolver() :
>                          new QRDecompositionImpl(mA).getSolver();
> -                final double[] dX = solver.solve(b);
> -
> +                final RealVector dummy = solver.solve(new ArrayRealVector(b, 
> false));
> +                final double[] dX;
> +                if (dummy instanceof ArrayRealVector){
> +                    dX = ((ArrayRealVector) dummy).getDataRef();
> +                }else{
> +                    dX = dummy.getData();
> +                }

In my opinion, the hypothetical efficiency gain is not worth the convoluted
code so:
---
  final double[] dX = solver.solve(new ArrayRealVector(b, false)).toArray();
---

Also, next time, when you'll really need a curly bracket ;-), please insert
a space character before it, and around keywords too:
---
if (ok) {
  // ...
} else {
  // ...
}
---

Sorry to be picky and thank you,
Gilles

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

Reply via email to