ArgumentChecker.noNulls(bucketCDSs, "bucketCDSs");
ArgumentChecker.notNull(creditCurve, "creditCurve");
ArgumentChecker.notNull(yieldCurve, "yieldCurve");
final int m = cds.length;
ArgumentChecker.isTrue(m == cdsCoupon.length, m + " CDSs but " + cdsCoupon.length + " coupons");
final LUDecompositionCommons decomp = new LUDecompositionCommons();
final int n = bucketCDSs.length;
final DoubleMatrix2D jacT = new DoubleMatrix2D(n, n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
jacT.getData()[j][i] = _pricer.parSpreadCreditSensitivity(bucketCDSs[i], yieldCurve, creditCurve, j);
}
}
final double[] vLambda = new double[n];
final double[][] res = new double[m][];
final LUDecompositionResult luRes = decomp.evaluate(jacT);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
vLambda[j] = _pricer.pvCreditSensitivity(cds[i], yieldCurve, creditCurve, cdsCoupon[i], j);
}
res[i] = luRes.solve(vLambda);