net.finmath.montecarlo.process
Class LinearInterpolatedTimeDiscreteProcess
- java.lang.Object
-
- net.finmath.montecarlo.process.LinearInterpolatedTimeDiscreteProcess
-
- All Implemented Interfaces:
- ProcessInterface
public class LinearInterpolatedTimeDiscreteProcess extends java.lang.Object implements ProcessInterface
A linear interpolated time discrete process, that is, given a collection of tuples (Double, RandomVariable) representing realizations \( X(t_{i}) \) this class implements theProcessInterfaceand creates a stochastic process \( t \mapsto X(t) \) where \[ X(t) = \frac{t_{i+1} - t}{t_{i+1}-t_{i}} X(t_{i}) + \frac{t - t_{i}}{t_{i+1}-t_{i}} X(t_{i+1}) \] with \( t_{i} \leq t \leq t_{i+1} \). Note: this is the interpolation scheme used in the convergence of the Euler-Maruyama scheme.
-
-
Constructor Summary
Constructors Constructor and Description LinearInterpolatedTimeDiscreteProcess(java.util.Map<java.lang.Double,RandomVariableInterface> realizations)Create a time discrete process by linear interpolation of random variables.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description LinearInterpolatedTimeDiscreteProcessadd(LinearInterpolatedTimeDiscreteProcess process)Create a new linear interpolated time discrete process by using the time discretization of this process and the sum of this process and the given one as its values.LinearInterpolatedTimeDiscreteProcessapply(java.util.function.DoubleUnaryOperator function)Create a new process consisting of the interpolation of the random variables obtained by applying the given function to this process discrete set of random variables.ProcessInterfaceclone()Create and return a clone of this process.RandomVariableInterfacegetMonteCarloWeights(int timeIndex)This method returns the weights of a weighted Monte Carlo method (the probability density).intgetNumberOfComponents()RandomVariableInterfacegetProcessValue(double time, int component)Returns the (possibly interpolated) value of this stochastic process at a given time \( t \).RandomVariableInterfacegetProcessValue(int timeIndex, int component)This method returns the realization of a component of the process for a given time index.doublegetTime(int timeIndex)TimeDiscretizationInterfacegetTimeDiscretization()intgetTimeIndex(double time)Returns the time index for a given simulation time.
-
-
-
Constructor Detail
-
LinearInterpolatedTimeDiscreteProcess
public LinearInterpolatedTimeDiscreteProcess(java.util.Map<java.lang.Double,RandomVariableInterface> realizations)
Create a time discrete process by linear interpolation of random variables.- Parameters:
realizations- Given map from time to random variable. The map must not be modified.
-
-
Method Detail
-
add
public LinearInterpolatedTimeDiscreteProcess add(LinearInterpolatedTimeDiscreteProcess process) throws CalculationException
Create a new linear interpolated time discrete process by using the time discretization of this process and the sum of this process and the given one as its values.- Parameters:
process- A given process.- Returns:
- A new process representing the of this and the given process.
- Throws:
CalculationException- Thrown if the given process fails to evaluate at a certain time point.
-
apply
public LinearInterpolatedTimeDiscreteProcess apply(java.util.function.DoubleUnaryOperator function)
Create a new process consisting of the interpolation of the random variables obtained by applying the given function to this process discrete set of random variables. That is \( t \mapsto Y(t) \) where \[ Y(t) = \frac{t_{i+1} - t}{t_{i+1}-t_{i}} f(X(t_{i})) + \frac{t - t_{i}}{t_{i+1}-t_{i}} f(X(t_{i+1})) \] with \( t_{i} \leq t \leq t_{i+1} \) and a given function \( f \).- Parameters:
function- The function \( f \), a univariate function.- Returns:
- A new process consisting of the interpolation of the random variables obtained by applying the given function to this process discrete set of random variables.
-
getProcessValue
public RandomVariableInterface getProcessValue(double time, int component) throws CalculationException
Returns the (possibly interpolated) value of this stochastic process at a given time \( t \).- Parameters:
time- The time \( t \).component- The component to be returned (if this is a vector valued process), otherwise 0.- Returns:
- The random variable \( X(t) \).
- Throws:
CalculationException- Thrown if this process fails to evaluate at the given time point.
-
getProcessValue
public RandomVariableInterface getProcessValue(int timeIndex, int component) throws CalculationException
Description copied from interface:ProcessInterfaceThis method returns the realization of a component of the process for a given time index.- Specified by:
getProcessValuein interfaceProcessInterface- Parameters:
timeIndex- Time index at which the process should be observedcomponent- Component index of the process- Returns:
- The process component realizations (given as
RandomVariable) - Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getMonteCarloWeights
public RandomVariableInterface getMonteCarloWeights(int timeIndex) throws CalculationException
Description copied from interface:ProcessInterfaceThis method returns the weights of a weighted Monte Carlo method (the probability density).- Specified by:
getMonteCarloWeightsin interfaceProcessInterface- Parameters:
timeIndex- Time index at which the process should be observed- Returns:
- A vector of positive weights which sums up to one
- Throws:
CalculationException- Thrown if the valuation fails, specific cause may be available via thecause()method.
-
getNumberOfComponents
public int getNumberOfComponents()
- Specified by:
getNumberOfComponentsin interfaceProcessInterface- Returns:
- Returns the numberOfComponents.
-
getTimeDiscretization
public TimeDiscretizationInterface getTimeDiscretization()
- Specified by:
getTimeDiscretizationin interfaceProcessInterface- Returns:
- Returns the timeDiscretization.
-
getTime
public double getTime(int timeIndex)
- Specified by:
getTimein interfaceProcessInterface- Parameters:
timeIndex- Time index.- Returns:
- Returns the time for a given time index.
-
getTimeIndex
public int getTimeIndex(double time)
Description copied from interface:ProcessInterfaceReturns the time index for a given simulation time.- Specified by:
getTimeIndexin interfaceProcessInterface- Parameters:
time- The given simulation time.- Returns:
- Returns the time index for a given time
-
clone
public ProcessInterface clone()
Description copied from interface:ProcessInterfaceCreate and return a clone of this process. The clone is not tied to any model, but has the same process specification, that is, if the model is the same, it would generate the same paths.- Specified by:
clonein interfaceProcessInterface- Overrides:
clonein classjava.lang.Object- Returns:
- Clone of the process
-
-
DataMelt 3.0 © DataMelt by jWork.ORG