/** * Initiates the fit. N is the number of y-data points, K is the dimension of the fit function and * M is the number of fit parameters. Call <code>this.fit()</code> to start the actual fitting. * * @param function The model function to be fitted. Must be able to take M input parameters. * @param parameters The initial guess for the fit parameters, length M. * @param yDataPoints The y-data points in an array. * @param xDataPoints The x-data points for each y data point, double[y-index][x-index] Size must * be <code>double[N][K]</code>, where N is the number of measurements and K is the dimension * of the fit function. * @param weights The weights, normally given as: <code>weights[i] = 1 / sigma_i^2</code>. If you * have a bad data point, set its weight to zero. If the given array is null, a new array is * created with all elements set to 1. * @param alpha An LMAMatrix instance. Must be initiated to (M x M) size. */ public LMA( LMAMultiDimFunction function, double[] parameters, double[] yDataPoints, double[][] xDataPoints, double[] weights, LMAMatrix alpha) { init(function, parameters, yDataPoints, xDataPoints, weights, alpha); }
/** * Initiates the fit. N is the number of y-data points, K is the dimension of the fit function and * M is the number of fit parameters. Call <code>this.fit()</code> to start the actual fitting. * * @param function The model function to be fitted. Input parameter sizes K and M. * @param parameters The initial guess for the fit parameters, length M. * @param dataPoints The data points in two dimensional array where each array, dataPoints[i], * contains one y-value followed by the corresponding x-array values. I.e., the arrays should * look like this: * <p>dataPoints[0] = y0 x00 x01 x02 ... x0[K-1]<br> * dataPoints[1] = y1 x10 x11 x12 ... x1[K-1]<br> * . ..<br> * dataPoints[N] = yN xN0 xN1 xN2 ... x[N-1][K-1] * <p> * @param weights The weights, normally given * as: <code>weights[i] = 1 / sigma_i^2</code>. If * you have a bad data point, set its weight to zero. If the given array is null, a new array * is created with all elements set to 1. * @param alpha An LMAMatrix instance. Must be initiated to (M x M) size. */ public LMA( LMAMultiDimFunction function, double[] parameters, double[][] dataPoints, double[] weights, LMAMatrix alpha) { SeparatedData s = ArrayConverter.separateMultiDimDataToXY(dataPoints); this.yDataPoints = s.yDataPoints; this.xDataPoints = s.xDataPoints; init(function, parameters, yDataPoints, xDataPoints, weights, alpha); }