Simplification of the conversion from RealVector to double[].

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1164662 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastien Brisard 2011-09-02 18:20:37 +00:00
parent de75806149
commit 6a895ec220
1 changed files with 1 additions and 7 deletions

View File

@ -148,13 +148,7 @@ public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {
DecompositionSolver solver = useLU ?
new LUDecompositionImpl(mA).getSolver() :
new QRDecompositionImpl(mA).getSolver();
final RealVector dummy = solver.solve(new ArrayRealVector(b, false));
final double[] dX;
if (dummy instanceof ArrayRealVector){
dX = ((ArrayRealVector) dummy).getDataRef();
}else{
dX = dummy.getData();
}
final double[] dX = solver.solve(new ArrayRealVector(b, false)).toArray();
// update the estimated parameters
for (int i = 0; i < cols; ++i) {
point[i] += dX[i];