@Test
public void testLeastSquares2()
throws FunctionEvaluationException, ConvergenceException {
final RealMatrix factors =
new Array2DRowRealMatrix(new double[][] {
{ 1.0, 0.0 },
{ 0.0, 1.0 }
}, false);
LeastSquaresConverter ls = new LeastSquaresConverter(new MultivariateVectorialFunction() {
public double[] value(double[] variables) {
return factors.operate(variables);
}
}, new double[] { 2.0, -3.0 }, new double[] { 10.0, 0.1 });
NelderMead optimizer = new NelderMead();
optimizer.setConvergenceChecker(new SimpleScalarValueChecker(-1.0, 1.0e-6));
optimizer.setMaxIterations(200);