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:
parent
de75806149
commit
6a895ec220
|
@ -148,13 +148,7 @@ public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {
|
||||||
DecompositionSolver solver = useLU ?
|
DecompositionSolver solver = useLU ?
|
||||||
new LUDecompositionImpl(mA).getSolver() :
|
new LUDecompositionImpl(mA).getSolver() :
|
||||||
new QRDecompositionImpl(mA).getSolver();
|
new QRDecompositionImpl(mA).getSolver();
|
||||||
final RealVector dummy = solver.solve(new ArrayRealVector(b, false));
|
final double[] dX = solver.solve(new ArrayRealVector(b, false)).toArray();
|
||||||
final double[] dX;
|
|
||||||
if (dummy instanceof ArrayRealVector){
|
|
||||||
dX = ((ArrayRealVector) dummy).getDataRef();
|
|
||||||
}else{
|
|
||||||
dX = dummy.getData();
|
|
||||||
}
|
|
||||||
// update the estimated parameters
|
// update the estimated parameters
|
||||||
for (int i = 0; i < cols; ++i) {
|
for (int i = 0; i < cols; ++i) {
|
||||||
point[i] += dX[i];
|
point[i] += dX[i];
|
||||||
|
|
Loading…
Reference in New Issue