class DiscreteVolatilityFunctionProviderDirect extends DiscreteVolatilityFunctionProvider {

  @Override
  public DiscreteVolatilityFunction from(final DoublesPair[] expiryStrikePoints) {
    ArgumentChecker.noNulls(expiryStrikePoints, "strikeExpiryPoints");
    final int n = expiryStrikePoints.length;
    final IdentityMatrix iM = new IdentityMatrix(n);
    return new DiscreteVolatilityFunction() {

      @Override
      public DoubleMatrix1D evaluate(final DoubleMatrix1D x) {
        ArgumentChecker.isTrue(x.getNumberOfElements() == n, "size of x");
        return new DoubleMatrix1D(x.getData());
      }

      @Override
      public DoubleMatrix2D calculateJacobian(final DoubleMatrix1D x) {
        return iM;
      }

      @Override
      public int getLengthOfDomain() {
        return n;
      }

      @Override
      public int getLengthOfRange() {
        return n;
      }

    };
  }

}