@Override
	public RandomVariableInterface getVolatility(int timeIndex, int liborIndex) {
		// Create a very simple volatility model here
		double time             = getTimeDiscretization().getTime(timeIndex);
		double maturity         = getLiborPeriodDiscretization().getTime(liborIndex);
		double timeToMaturity   = maturity-time;

		double volatilityInstanteaneous;
		if(timeToMaturity <= 0)
		{
			volatilityInstanteaneous = 0.0;   // This forward rate is already fixed, no volatility
		}
		else
		{
			volatilityInstanteaneous = (a[liborIndex] + b[liborIndex] * timeToMaturity) * Math.exp(-c[liborIndex] * timeToMaturity) + d[liborIndex];
		}
		if(volatilityInstanteaneous < 0.0) {
			volatilityInstanteaneous = Math.max(volatilityInstanteaneous,0.0);
		}

		return new RandomVariable(getTimeDiscretization().getTime(timeIndex),volatilityInstanteaneous);
	}
@ Override public RandomVariableInterface getVolatility ( int timeIndex , int liborIndex ) { double time = getTimeDiscretization ( ) . getTime ( timeIndex ) ; double maturity = getLiborPeriodDiscretization ( ) . getTime ( liborIndex ) ; double timeToMaturity = maturity - time ; double volatilityInstanteaneous ; if ( timeToMaturity <= 0 ) { volatilityInstanteaneous = 0.0 ; } else { volatilityInstanteaneous = ( a [ liborIndex ] + b [ liborIndex ] * timeToMaturity ) * Math . exp ( - c [ liborIndex ] * timeToMaturity ) + d [ liborIndex ] ; } if ( volatilityInstanteaneous < 0.0 ) { volatilityInstanteaneous = Math . max ( volatilityInstanteaneous , 0.0 ) ; } return new RandomVariable ( getTimeDiscretization ( ) . getTime ( timeIndex ) , volatilityInstanteaneous ) ; }
/* (non-Javadoc)
@see net.finmath.montecarlo.interestrate.modelplugins.LIBORVolatilityModel#getVolatility(int, int)