public static double[] hedgeQuantity(final MultipleCurrencyParameterSensitivity ps, final MultipleCurrencyParameterSensitivity[] rs, final DoubleMatrix2D w,
final LinkedHashSet<Pair<String, Integer>> order, final FXMatrix fxMatrix) {
final Currency ccy = ps.getAllNamesCurrency().iterator().next().getSecond();
// Implementation note: currency used for the conversion in a common currency. Any currency is fine.
final int nbReference = rs.length;
final MultipleCurrencyParameterSensitivity psConverted = ps.converted(fxMatrix, ccy);
final MultipleCurrencyParameterSensitivity[] rsConverted = new MultipleCurrencyParameterSensitivity[nbReference];
for (int loopref = 0; loopref < nbReference; loopref++) {
rsConverted[loopref] = rs[loopref].converted(fxMatrix, ccy);
}
// Implementation note: converting the ParameterSensitivity into a matrix.