public GFunctionExactYield(CmsCoupon coupon)
{
SwapIndex swapIndex = coupon.swapIndex();
VanillaSwap swap = swapIndex.underlyingSwap(coupon.fixingDate());
Schedule schedule = swap.fixedSchedule();
Handle <YieldTermStructure> rateCurve = swapIndex.forwardingTermStructure();
DayCounter dc = swapIndex.dayCounter();
double swapStartTime = dc.yearFraction(rateCurve.link.referenceDate(), schedule.startDate());
double swapFirstPaymentTime = dc.yearFraction(rateCurve.link.referenceDate(), schedule.date(1));
double paymentTime = dc.yearFraction(rateCurve.link.referenceDate(), coupon.date());
delta_ = (paymentTime - swapStartTime) / (swapFirstPaymentTime - swapStartTime);
List <CashFlow> fixedLeg = new List <CashFlow>(swap.fixedLeg());
int n = fixedLeg.Count;
accruals_ = new List <double>();
for (int i = 0; i < n; ++i)
{
Coupon coupon1 = fixedLeg[i] as Coupon;
accruals_.Add(coupon1.accrualPeriod());
}
}