// solve the linearized least squares problem
RealMatrix mA = new BlockRealMatrix(a);
DecompositionSolver solver = useLU ?
new LUDecompositionImpl(mA).getSolver() :
new QRDecompositionImpl(mA).getSolver();
final double[] dX = solver.solve(b);
// update the estimated parameters
for (int i = 0; i < cols; ++i) {
point[i] += dX[i];