// I use TLP: return array of curves, initialised after shifting mktRateSet elements of forwarding curve public IMultiRateCurve[] ShiftedCurvesArrayFwdCurve(double shift) { // i-curve is built using its setup (interpolator,..), but shifting i-element of mktRateSet // up of 'shift' quantity RateSet[] rsArr = mktRateSet.ShiftedRateSetArray(shift); // array of shifted RateSet (my scenario) int n = rsArr.Length; // number of elements IMultiRateCurve[] curves = new IMultiRateCurve[n]; // array of curves Parallel.For(0, n, i => { curves[i] = CreateInstance(rsArr[i], DCurve); // build the correct curve }); return(curves); }
// return array of curves, initialised after shifting mktRateSet elements public ISingleRateCurve[] ShiftedCurveArray(double shift) { // i-curve is built using its setup (interpolator,..), but shifting i-element of mktRateSet // up of 'shift' quantity RateSet[] rsArr = mktRateSet.ShiftedRateSetArray(shift); // array of shifted RateSet (my scenario) int n = rsArr.Length; // number of elements ISingleRateCurve[] curves = new ISingleRateCurve[n]; // array of curves for (int i = 0; i < n; i++) { // iterate to build all curve needed curves[i] = CreateInstance(rsArr[i]); // build the correct curve } return(curves); }