class MultiCapFloorPricerGrid extends MultiCapFloorPricer {

  @Override
  public double[] priceFromCapletVols(double[] capletVolGridValues) {
    ArgumentChecker.notEmpty(capletVolGridValues, "null caplet volatilities");
    ArgumentChecker.isTrue(_gridSize == capletVolGridValues.length, "Expect caplet vols on a (flatened) grid of {} strikes by {} expiries, so {} values. Given {} capletVols", getStrikes().length,
        getCapletExpiries().length, _gridSize, capletVolGridValues.length);

    // If _gridSize < _nCaplets not all the elements of capletVolGridValues are used. This is because some of the volatilities
    // refer to caplets not found in any caps (we are considering) and are in effect dummy values for calibration methods that
    // require a complete (i.e. no missing elements) grid.
    int n = getNumCaplets();
    double[] capletPrices = new double[n];
    for (int i = 0; i < n; i++) {
      capletPrices[i] = BlackFormulaRepository.price(getOption(i), capletVolGridValues[_optionsToGridMap[i]]);
    }
    return priceFromCapletPrices(capletPrices);
  }

  public  MultiCapFloorPricerGrid(List<CapFloor> caps, MulticurveProviderInterface curves);

}