class ParameterSensitivityWeightMatrixCalculator {

  public DoubleMatrix2D projectCurveNodes(final MulticurveProviderDiscount curves, final LinkedHashSet<Pair<String, Integer>> order, final double[] objNodes) {
    ArgumentChecker.notNull(curves, "curves");
    ArgumentChecker.notNull(order, "order");
    ArgumentChecker.notNull(objNodes, "objNodes");

    int nCurves = order.size();
    ArgumentChecker.isTrue(nCurves > 0, "order should not be empty");
    Iterator<Pair<String, Integer>> it = order.iterator();
    DoubleMatrix2D[] resArray = new DoubleMatrix2D[nCurves];
    int nRowsTotal = 0;
    int nColsTotal = 0;
    for (int i = 0; i < nCurves; ++i) {
      resArray[i] = projectSingleCurveNodes(curves, it.next(), objNodes);
      nRowsTotal += resArray[i].getNumberOfRows();
      nColsTotal += resArray[i].getNumberOfColumns();
    }

    double[][] res = new double[nRowsTotal][nColsTotal];
    int offsetRow = 0;
    int offsetCol = 0;
    for (int i = 0; i < nCurves; ++i) {
      int nRows = resArray[i].getNumberOfRows();
      int nCols = resArray[i].getNumberOfColumns();
      for (int j = 0; j < nRows; ++j) {
        for (int k = 0; k < nCols; ++k) {
          res[j + offsetRow][k + offsetCol] = resArray[i].getData()[j][k];
        }
      }
      offsetRow += nRows;
      offsetCol += nCols;
    }

    return new DoubleMatrix2D(res);
  }

}