@ Override public RandomVariable getNumeraire ( double time ) throws CalculationException { int timeIndex = getLiborPeriodIndex ( time ) ; if ( timeIndex < 0 ) { // Interpolation of Numeraire: linear interpolation of the reciprocal. int lowerIndex = - timeIndex - 1 ; int upperIndex = - timeIndex ; double alpha = ( time - getLiborPeriod ( lowerIndex ) ) / ( getLiborPeriod ( upperIndex ) - getLiborPeriod ( lowerIndex ) ) ; return getNumeraire ( getLiborPeriod ( upperIndex ) ) . invert ( ) . mult ( alpha ) . add ( getNumeraire ( getLiborPeriod ( lowerIndex ) ) . invert ( ) . mult ( 1.0 - alpha ) ) . invert ( ) ; } // Calculate the numeraire, when time is part of liborPeriodDiscretization // Get the start of the product int firstLiborIndex = getLiborPeriodIndex ( time ) ; if ( firstLiborIndex < 0 ) { throw new CalculationException ( "Simulation time discretization not part of forward rate tenor discretization." ) ; } // Get the end of the product int lastLiborIndex = liborPeriodDiscretization . getNumberOfTimeSteps ( ) - 1 ; if ( measure == Measure . SPOT ) { // Spot measure firstLiborIndex = 0 ; lastLiborIndex = getLiborPeriodIndex ( time ) - 1 ; } /* * Calculation of the numeraire */ // Initialize to 1.0 RandomVariable numeraire = new RandomVariableFromDoubleArray ( time , 1.0 ) ; // The product for ( int liborIndex = firstLiborIndex ; liborIndex <= lastLiborIndex ; liborIndex ++ ) { RandomVariable libor = getLIBOR ( getTimeIndex ( Math . min ( time , liborPeriodDiscretization . getTime ( liborIndex ) ) ) , liborIndex ) ; double periodLength = liborPeriodDiscretization . getTimeStep ( liborIndex ) ; if ( measure == Measure . SPOT ) { numeraire = numeraire . accrue ( libor , periodLength ) ; } else { numeraire = numeraire . discount ( libor , periodLength ) ; } } /* * Adjust for discounting */ if ( discountCurve != null ) { DiscountCurve discountcountCurveFromForwardPerformance = new DiscountCurveFromForwardCurve ( forwardRateCurve ) ; double deterministicNumeraireAdjustment = discountcountCurveFromForwardPerformance . getDiscountFactor ( time ) / discountCurve . getDiscountFactor ( time ) ; numeraire = numeraire . mult ( deterministicNumeraireAdjustment ) ; } return numeraire ; }
Return the numeraire at a given time . The numeraire is provided for interpolated points . If requested on points which are not part of the tenor discretization the numeraire uses a linear interpolation of the reciprocal value . See ISBN 0470047224 for details .