Documentation of 'net.finmath.stochastic.RandomVariableMutableClone' Java class
RandomVariableMutableClone
net.finmath.stochastic

Class RandomVariableMutableClone

  • All Implemented Interfaces:
    java.io.Serializable, RandomVariableInterface

    Deprecated.

    public class RandomVariableMutableClone
    extends java.lang.Object
    implements RandomVariableInterface
    This class wraps an immutable class (here RandomVariableInterface) and implements the interface of an mutable class (here RandomVariableInterface). If a method is called which mutates the object (a mutator), a defensive copy is performed once. The reference to the immutable class is then replaced by the reference to the defensive copy. By returning an RandomVariableMutableClone of an RandomVariableInterface defensive copies are made only when necessary. This class is not thread safe (classes implementing RandomVariableInterface are not expected to be thread safe).
    See Also:
    Serialized Form
    • Constructor Detail

      • RandomVariableMutableClone

        public RandomVariableMutableClone(RandomVariableInterface randomVariable)
        Deprecated. 
    • Method Detail

      • add

        public RandomVariableInterface add(double value)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → x + value to this random variable. It returns a new random variable with the result.
        Specified by:
        add in interface RandomVariableInterface
        Parameters:
        value - The value to add.
        Returns:
        New random variable with the result of the function.
      • accrue

        public RandomVariableInterface accrue(RandomVariableInterface rate,
                                              double periodLength)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → x * (1.0 + rate * periodLength) to this random variable.
        Specified by:
        accrue in interface RandomVariableInterface
        Parameters:
        rate - The accruing rate. A random variable (compatible with this random variable).
        periodLength - The period length
        Returns:
        New random variable with the result of the function.
      • barrier

        public RandomVariableInterface barrier(RandomVariableInterface trigger,
                                               RandomVariableInterface valueIfTriggerNonNegative,
                                               double valueIfTriggerNegative)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → (trigger ≥ 0 ? valueIfTriggerNonNegative : valueIfTriggerNegative)
        Specified by:
        barrier in interface RandomVariableInterface
        Parameters:
        trigger - The trigger. A random variable (compatible with this random variable).
        valueIfTriggerNonNegative - The value used if the trigger is greater or equal 0
        valueIfTriggerNegative - The value used if the trigger is less than 0
        Returns:
        New random variable with the result of the function.
      • cap

        public RandomVariableInterface cap(double cap)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → min(x,cap) to this random variable. It returns a new random variable with the result.
        Specified by:
        cap in interface RandomVariableInterface
        Parameters:
        cap - The cap.
        Returns:
        New random variable with the result of the function.
      • discount

        public RandomVariableInterface discount(RandomVariableInterface rate,
                                                double periodLength)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → x / (1.0 + rate * periodLength) to this random variable.
        Specified by:
        discount in interface RandomVariableInterface
        Parameters:
        rate - The discounting rate. A random variable (compatible with this random variable).
        periodLength - The period length
        Returns:
        New random variable with the result of the function.
      • equals

        public boolean equals(RandomVariableInterface randomVariable)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Compare this random variable with a given one
        Specified by:
        equals in interface RandomVariableInterface
        Parameters:
        randomVariable - Random variable to compare with.
        Returns:
        True if this random variable and the given one are equal, otherwise false
      • floor

        public RandomVariableInterface floor(double floor)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → max(x,floor) to this random variable. It returns a new random variable with the result.
        Specified by:
        floor in interface RandomVariableInterface
        Parameters:
        floor - The floor.
        Returns:
        New random variable with the result of the function.
      • get

        public double get(int pathOrState)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Evaluate at a given path or state.
        Specified by:
        get in interface RandomVariableInterface
        Parameters:
        pathOrState - Index of the path or state.
        Returns:
        Value of this random variable at the given path or state.
      • getAverage

        public double getAverage(RandomVariableInterface probabilities)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the expectation of this random variable for a given probability measure (weight). The result of this method is (mathematically) equivalent to
        this.mult(probabilities).getAverage() / probabilities.getAverage()
        while the internal implementation may differ, e.g. being more efficient by performing multiplication and summation in the same loop.
        Specified by:
        getAverage in interface RandomVariableInterface
        Parameters:
        probabilities - The probability weights.
        Returns:
        The average assuming the given probability weights.
      • getQuantile

        public double getQuantile(double quantile)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the quantile value for this given random variable, i.e., the value x such that P(this < x) = quantile, where P denotes the probability measure. The method will consider picewise constant values (with constant extrapolation) in the random variable. That is getQuantile(0) and getQuantile(1) will return the largest and smallest value.
        Specified by:
        getQuantile in interface RandomVariableInterface
        Parameters:
        quantile - The quantile level.
        Returns:
        The quantile value assuming equi-distribution.
      • getQuantile

        public double getQuantile(double quantile,
                                  RandomVariableInterface probabilities)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the quantile value for this given random variable, i.e., the value x such that P(this < x) = quantile, where P denotes the probability measure.
        Specified by:
        getQuantile in interface RandomVariableInterface
        Parameters:
        quantile - The quantile level.
        probabilities - The probability weights.
        Returns:
        The quantile value assuming the given probability weights.
      • getQuantileExpectation

        public double getQuantileExpectation(double quantileStart,
                                             double quantileEnd)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the expectation over a quantile for this given random variable. The method will consider picewise constant values (with constant extrapolation) in the random variable. For a ≤ b the method returns (Σa ≤ i ≤ b x[i]) / (b-a+1), where
        • a = min(max((n+1) * quantileStart - 1, 0, 1);
        • b = min(max((n+1) * quantileEnd - 1, 0, 1);
        • n = this.size();
        For quantileStart > quantileEnd the method returns getQuantileExpectation(quantileEnd, quantileStart).
        Specified by:
        getQuantileExpectation in interface RandomVariableInterface
        Parameters:
        quantileStart - Lower bound of the integral.
        quantileEnd - Upper bound of the integral.
        Returns:
        The (conditional) expectation of the values between two quantile levels assuming equi-distribution.
      • getHistogram

        public double[] getHistogram(double[] intervalPoints)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Generates a Histogram based on the realizations stored in this random variable. The returned result array's length is intervalPoints.length+1.
        • The value result[0] equals the relative frequency of values observed in the interval ( -infinity, intervalPoints[0] ].
        • The value result[i] equals the relative frequency of values observed in the interval ( intervalPoints[i-1], intervalPoints[i] ].
        • The value result[n] equals the relative frequency of values observed in the interval ( intervalPoints[n-1], infinity ).
        where n = intervalPoints.length. Note that the intervals are open on the left, closed on the right, i.e., result[i] contains the number of elements x with intervalPoints[i-1] < x ≤ intervalPoints[i]. Thus, is you have a random variable which only takes values contained in the (sorted) array possibleValues, then result = getHistogram(possibleValues) returns an array where result[i] is the relative frequency of occurrence of possibleValues[i]. The sum of result[i] over all i is equal to 1, except for uninitialized random variables where all values are 0.
        Specified by:
        getHistogram in interface RandomVariableInterface
        Parameters:
        intervalPoints - Array of ascending values defining the interval boundaries.
        Returns:
        A histogram with respect to a provided interval.
      • getHistogram

        public double[][] getHistogram(int numberOfPoints,
                                       double standardDeviations)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Generates a histogram based on the realizations stored in this random variable using interval points calculated from the arguments, see also RandomVariableInterface.getHistogram(double[]). The interval points are set with equal distance over an the interval of the specified standard deviation. The interval points used are
        x[i] = mean + alpha[i] * standardDeviations * sigma
        where The methods result is an array of two vectors, where result[0] are the intervals center points ('anchor points') and result[1] contains the relative frequency for the interval. The 'anchor point' for the interval (-infinity, x[0]) is x[0] - 1/2 (x[1]-x[0]) and the 'anchor point' for the interval (x[n], infinity) is x[n] + 1/2 (x[n]-x[n-1]). Here n = numberOfPoints is the number of interval points.
        Specified by:
        getHistogram in interface RandomVariableInterface
        Parameters:
        numberOfPoints - The number of interval points.
        standardDeviations - The number of standard deviations defining the discretization radius.
        Returns:
        A histogram, given as double[2][], where result[0] are the center point of the intervals and result[1] is the value of RandomVariableInterface.getHistogram(double[]) for the given the interval points. The length of result[0] and result[1] is numberOfPoints+1.
      • apply

        public RandomVariableInterface apply(java.util.function.DoubleUnaryOperator operator)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → operator(x) to this random variable. It returns a new random variable with the result.
        Specified by:
        apply in interface RandomVariableInterface
        Parameters:
        operator - An unary operator/function, mapping double to double.
        Returns:
        New random variable with the result of the function.
      • apply

        public RandomVariableInterface apply(java.util.function.DoubleBinaryOperator operator,
                                             RandomVariableInterface argument)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → operator(x,y) to this random variable, where x is this random variable and y is a given random variable. It returns a new random variable with the result.
        Specified by:
        apply in interface RandomVariableInterface
        Parameters:
        operator - A binary operator/function, mapping (double,double) to double.
        argument - A random variable.
        Returns:
        New random variable with the result of the function.
      • apply

        public RandomVariableInterface apply(DoubleTernaryOperator operator,
                                             RandomVariableInterface argument1,
                                             RandomVariableInterface argument2)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Applies x → operator(x,y,z) to this random variable, where x is this random variable and y and z are given random variable. It returns a new random variable with the result.
        Specified by:
        apply in interface RandomVariableInterface
        Parameters:
        operator - A ternary operator/function, mapping (double,double,double) to double.
        argument1 - A random variable representing y.
        argument2 - A random variable representing z.
        Returns:
        New random variable with the result of the function.
      • getRealizations

        public double[] getRealizations()
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns a vector representing the realization of this random variable. This method is merely useful for analysis. Its interpretation depends on the context (Monte-Carlo or lattice). The method does not expose an internal data model.
        Specified by:
        getRealizations in interface RandomVariableInterface
        Returns:
        Vector of realizations of this random variable.
      • getRealizations

        public double[] getRealizations(int numberOfPaths)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the realizations as double array. If the random variable is deterministic, then it is expanded to the given number of paths.
        Specified by:
        getRealizations in interface RandomVariableInterface
        Parameters:
        numberOfPaths - The number of paths.
        Returns:
        The realization as double array.
      • getOperator

        public java.util.function.IntToDoubleFunction getOperator()
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the operator path -> this.get(path) corresponding to this random variable.
        Specified by:
        getOperator in interface RandomVariableInterface
        Returns:
        The operator path -> this.get(path) corresponding to this random variable.
      • getRealizationsStream

        public java.util.stream.DoubleStream getRealizationsStream()
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns a stream of doubles corresponding to the realizations of this random variable.
        Specified by:
        getRealizationsStream in interface RandomVariableInterface
        Returns:
        A stream of doubles corresponding to the realizations of this random variable.
      • getStandardDeviation

        public double getStandardDeviation()
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the standard deviation of this random variable, i.e., sqrt(V) where V = ((X-m)^2).getAverage() and X = this and m = X.getAverage().
        Specified by:
        getStandardDeviation in interface RandomVariableInterface
        Returns:
        The standard deviation assuming equi-distribution.
      • getStandardDeviation

        public double getStandardDeviation(RandomVariableInterface probabilities)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the standard deviation of this random variable, i.e., sqrt(V) where V = ((X-m)^2).getAverage(probabilities) and X = this and m = X.getAverage(probabilities).
        Specified by:
        getStandardDeviation in interface RandomVariableInterface
        Parameters:
        probabilities - The probability weights.
        Returns:
        The standard error assuming the given probability weights.
      • getVariance

        public double getVariance()
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the variance of this random variable, i.e., V where V = ((X-m)^2).getAverage() and X = this and m = X.getAverage().
        Specified by:
        getVariance in interface RandomVariableInterface
        Returns:
        The average assuming equi-distribution.
      • getVariance

        public double getVariance(RandomVariableInterface probabilities)
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Returns the variance of this random variable, i.e., V where V = ((X-m)^2).getAverage(probabilities) and X = this and m = X.getAverage(probabilities).
        Specified by:
        getVariance in interface RandomVariableInterface
        Parameters:
        probabilities - The probability weights.
        Returns:
        The average assuming the given probability weights.
      • isDeterministic

        public boolean isDeterministic()
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Check if this random variable is deterministic in the sense that it is represented by a single double value. Note that the methods returns false, if the random variable is represented by a vector where each element has the same value.
        Specified by:
        isDeterministic in interface RandomVariableInterface
        Returns:
        True if this random variable is deterministic.
      • cache

        public RandomVariableInterface cache()
        Deprecated. 
        Description copied from interface: RandomVariableInterface
        Return a cacheable version of this object (often a self-reference). This method should be called when you store the object for later use, i.e., assign it, or when the object is consumed in a function, but later used also in another function.
        Specified by:
        cache in interface RandomVariableInterface
        Returns:
        A cacheable version of this object (often a self-reference).

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.