/**
  * Build a simple converter for correlated residuals with the specific weights.
  *
  * <p>The scalar objective function value is computed as:
  *
  * <pre>
  * objective = y<sup>T</sup>y with y = scale&times;(observation-objective)
  * </pre>
  *
  * <p>The array computed by the objective function, the observations array and the the scaling
  * matrix must have consistent sizes or a {@link FunctionEvaluationException} will be triggered
  * while computing the scalar objective.
  *
  * @param function vectorial residuals function to wrap
  * @param observations observations to be compared to objective function to compute residuals
  * @param scale scaling matrix
  * @exception IllegalArgumentException if the observations vector and the scale matrix dimensions
  *     don't match (objective function dimension is checked only when the {@link #value(double[])}
  *     method is called)
  */
 public LeastSquaresConverter(
     final MultivariateVectorialFunction function,
     final double[] observations,
     final RealMatrix scale)
     throws IllegalArgumentException {
   if (observations.length != scale.getColumnDimension()) {
     throw MathRuntimeException.createIllegalArgumentException(
         "dimension mismatch {0} != {1}", observations.length, scale.getColumnDimension());
   }
   this.function = function;
   this.observations = observations.clone();
   this.weights = null;
   this.scale = scale.copy();
 }