// The functionality below takes the original "double" curves // and converts them to AD curves. public void SetAdCurvesFromOrdinaryCurve() { List <ADouble> discValues = new List <ADouble>(); for (int i = 0; i < DiscCurve.Values.Count; i++) { discValues.Add(new MasterThesis.ADouble(DiscCurve.Values[i])); } ADDiscCurve = new MasterThesis.Curve_AD(DiscCurve.Dates, discValues); ADFwdCurveCollection = new ADFwdCurveContainer(); foreach (CurveTenor tenor in FwdCurveCollection.Curves.Keys) { List <ADouble> tempValues = new List <ADouble>(); for (int i = 0; i < FwdCurveCollection.GetCurve(tenor).Values.Count; i++) { tempValues.Add(new ADouble(FwdCurveCollection.GetCurve(tenor).Values[i])); } Curve_AD tempCurve = new Curve_AD(FwdCurveCollection.GetCurve(tenor).Dates, tempValues); ADFwdCurveCollection.AddCurve(tempCurve, tenor); } ADCurvesHasBeenSet = true; }
public LinearRateModel(Curve_AD discCurve, ADFwdCurveContainer fwdCurveCollection, InterpMethod interpolation = InterpMethod.Linear) { ADDiscCurve = discCurve; ADFwdCurveCollection = fwdCurveCollection; Interpolation = interpolation; }