List of usage examples for org.apache.commons.math3.fitting.leastsquares LeastSquaresFactory create
public static LeastSquaresProblem create(final MultivariateJacobianFunction model, final RealVector observed, final RealVector start, final RealMatrix weight, final ConvergenceChecker<Evaluation> checker, final int maxEvaluations, final int maxIterations)
From source file:iocomms.subpos.NonLinearLeastSquaresSolver.java
public Optimum solve(double[] target, double[] weights, double[] initialPoint, boolean debugInfo) { if (debugInfo) { System.out.println("Max Number of Iterations : " + MAXNUMBEROFITERATIONS); }/*from w ww . j av a 2s. c om*/ LeastSquaresProblem leastSquaresProblem = LeastSquaresFactory.create( // function to be optimized function, // target values at optimal point in least square equation // (x0+xi)^2 + (y0+yi)^2 + ri^2 = target[i] new ArrayRealVector(target, false), new ArrayRealVector(initialPoint, false), new DiagonalMatrix(weights), null, MAXNUMBEROFITERATIONS, MAXNUMBEROFITERATIONS); return leastSquaresOptimizer.optimize(leastSquaresProblem); }