Class AInterpolation<T,​U>

    • Method Detail

      • convertBucketToMaturity

        protected TreeMap<Double,​Integer> convertBucketToMaturity​(RuntimeData<U> runtimeData,
                                                                        IMarketDataRetrievalService.IPillarSet inputPillars)
        This function returns an ordered map that can be used to find interpolation vectors
        Parameters:
        runtimeData - infrastructure references
        inputPillars - The pillar set to convert
        Returns:
        an ordered map maturity -> pillar number
      • interpolate

        protected void interpolate​(RuntimeData<U> runtimeData,
                                   IMarketDataset<T,​U> result,
                                   IMarketDataset<T,​U> values,
                                   int depth,
                                   double[] location,
                                   int[] interpolationOrder,
                                   TreeMap<Double,​Integer>[] matToLoc,
                                   int shift)
        This function will fill a vector with interpolated data
        Parameters:
        runtimeData - infrastructure references
        result - the filled vector with the computed results
        values - the input values
        depth - the depth of the recursive loop
        location - the current computed location in term of days on each axis
        interpolationOrder - the requested axis order of the interpolation
        matToLoc - the interpolation map and the pillar description in term of nr of days
        shift - the current computed location in term of position in the result vector
      • interpolate

        protected com.quartetfs.fwk.impl.Pair<U,​String> interpolate​(RuntimeData<U> runtimeData,
                                                                          IMarketDataset<T,​U> values,
                                                                          int depth,
                                                                          double[] location,
                                                                          int[] interpolationOrder,
                                                                          TreeMap<Double,​Integer>[] matToLoc,
                                                                          int shift)
        This function will interpolate an output plot from an input set of values
        Parameters:
        runtimeData - infrastructure references
        values - the input data
        depth - the current depth of processing, the axis order
        location - the coordinates to interpolate
        interpolationOrder - the requested axis order of the interpolation
        matToLoc - the interpolation map and the pillar description in term of nr of days
        shift - the current computed shift in the input data
        Returns:
        the current interpolated value x the debug string
      • computeShift

        protected int computeShift​(int pillar,
                                   TreeMap<Double,​Integer>[] matToLoc,
                                   int axis)
        This function compute the shift on the data vector corresponding to the given pillar according to the pillar set topology
        Parameters:
        pillar - The pillar number we want to convert into shift
        matToLoc - The data topology
        axis - The axis number of the related pillar
        Returns:
        A shift compatible with the data vector
      • interpolation

        protected com.quartetfs.fwk.impl.Pair<U,​String> interpolation​(boolean generateDebugString,
                                                                            Double position,
                                                                            NavigableSet<Double> plots,
                                                                            BiFunction<Double,​U,​U> preInterpolationCalculation,
                                                                            BiFunction<Double,​U,​U> postInterpolationCalculation,
                                                                            Function<Double,​com.quartetfs.fwk.impl.Pair<U,​String>> retriever,
                                                                            com.activeviam.risk.ref.services.impl.marketdataretrieval.AInterpolation.ConvolutionMethod<U> convolution)
        Linear interpolation between two plots of a value
        Parameters:
        generateDebugString - flag to enable the generation of the interpolation debug string
        position - the position to interpolate
        plots - the available reference positions
        preInterpolationCalculation - The functions computed before the interpolation of market data is performed, defined for the current axis.
        postInterpolationCalculation - The functions computed after the interpolation of market data is performed, defined for the current axis.
        retriever - the function that return the value on a reference plot
        convolution - the function that combines two values for interpolation
        Returns:
        the interpolated value
      • removeOnePlot

        protected NavigableSet<Double> removeOnePlot​(NavigableSet<Double> plots,
                                                     Double plot)
        This function copy a list and remove one plot of it
        Parameters:
        plots - the input list
        plot - the plot to remove
        Returns:
        a copied list with one less plot
      • getDebugString

        protected String getDebugString​(com.quartetfs.fwk.impl.Pair<U,​String> result)
        Extract the debug string of the pair value / debug
        Parameters:
        result - the pair containing the debug string
        Returns:
        the debug string or empty
      • handleDebug

        protected void handleDebug​(boolean generateDebugString,
                                   com.quartetfs.fwk.impl.Pair<U,​String> result,
                                   Supplier<String> debug)
        Fill the debug string with the debug provider
        Parameters:
        generateDebugString - is debug enabled
        result - the result that will be filled
        debug - the debug string provider (the string is only computed if needed)
      • generateDebugString

        protected void generateDebugString​(boolean generateDebugString,
                                           Double position,
                                           com.quartetfs.fwk.impl.Pair<U,​String> result,
                                           Double p0)
        The debug string for a one pillar result
        Parameters:
        generateDebugString - is debug enabled
        position - the requested location
        result - the result to fill
        p0 - the retrieved location
      • applyCalculation

        protected void applyCalculation​(BiFunction<Double,​U,​U> calculation,
                                        Double pillar,
                                        com.quartetfs.fwk.impl.Pair<U,​String> applyResult,
                                        boolean generateDebugString)
        Apply a computation to the result if not null and take care of the debug string
        Parameters:
        calculation - the conversion function
        pillar - the location for the conversion
        applyResult - the result to modify
        generateDebugString - is debug activated