Class DoublesScheduleGenerator


  • public class DoublesScheduleGenerator
    extends Object
    The Doubles schedule generator.

    This is a utility for combining and truncating ascending arrays of doubles. The main application of this class is IsdaCdsProductPricer.

    • Method Detail

      • getIntegrationsPoints

        public static DoubleArray getIntegrationsPoints​(double start,
                                                        double end,
                                                        DoubleArray discountCurveNodes,
                                                        DoubleArray creditCurveNodes)
        Combines the discount curve nodes and credit curve nodes.

        The combined numbers are returned only if the values strictly between the specified start and end.

        The start and end values are added at the beginning and end of the list. If two times are very close (defined as less than half a day - 1/730 years different) only the smaller value is kept (with the exception of the end value which takes precedence).

        Parameters:
        start - the first time in the list
        end - the last time in the list
        discountCurveNodes - the discount curve node set
        creditCurveNodes - the credit curve node
        Returns:
        the combined list between start and end
      • truncateSetInclusive

        public static DoubleArray truncateSetInclusive​(double lower,
                                                       double upper,
                                                       DoubleArray set)
        Truncates an array of doubles.

        The number set is truncated so that it contains only the values between lower and upper, plus the values of lower and higher (as the first and last entry respectively).

        If no values met this criteria an array just containing lower and upper is returned. If the first (last) entry of set is too close to lower (upper), defined by TOL, the first (last) entry of set is replaced by lower (upper).

        Parameters:
        lower - the lower value
        upper - the upper value
        set - the numbers must be sorted in ascending order
        Returns:
        the truncated array