Module net.finmath.lib
Package net.finmath.montecarlo.process
Class LinearInterpolatedTimeDiscreteProcess
java.lang.Object
net.finmath.montecarlo.process.LinearInterpolatedTimeDiscreteProcess
- All Implemented Interfaces:
Process
A linear interpolated time discrete process, that is, given a collection of tuples
(
Double
, RandomVariable
) representing
realizations \( X(t_{i}) \) this class implements
the Process
and 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.- Version:
- 1.0
- Author:
- Christian Fries
-
Constructor Summary
ConstructorsConstructorDescriptionLinearInterpolatedTimeDiscreteProcess(Map<Double,RandomVariable> realizations)
Create a time discrete process by linear interpolation of random variables. -
Method Summary
Modifier and TypeMethodDescriptionadd(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.apply(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.clone()
Create and return a clone of this process.getMonteCarloWeights(int timeIndex)
This method returns the weights of a weighted Monte Carlo method (the probability density).int
getProcessValue(double time, int component)
Returns the (possibly interpolated) value of this stochastic process at a given time \( t \).getProcessValue(int timeIndex, int component)
This method returns the realization of a component of the process for a given time index.double
getTime(int timeIndex)
int
getTimeIndex(double time)
Returns the time index for a given simulation time.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.finmath.montecarlo.process.Process
getModel, getProcessValue
-
Constructor Details
-
LinearInterpolatedTimeDiscreteProcess
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 Details
-
add
public LinearInterpolatedTimeDiscreteProcess add(LinearInterpolatedTimeDiscreteProcess process) throws CalculationExceptionCreate 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
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
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) \).
-
getProcessValue
Description copied from interface:Process
This method returns the realization of a component of the process for a given time index.- Specified by:
getProcessValue
in interfaceProcess
- Parameters:
timeIndex
- Time index at which the process should be observed.component
- Component index of the process.- Returns:
- The process component realizations (given as
RandomVariableFromDoubleArray
)
-
getMonteCarloWeights
Description copied from interface:Process
This method returns the weights of a weighted Monte Carlo method (the probability density).- Specified by:
getMonteCarloWeights
in interfaceProcess
- Parameters:
timeIndex
- Time index at which the process should be observed- Returns:
- A vector of positive weights which sums up to one
-
getNumberOfComponents
public int getNumberOfComponents()- Specified by:
getNumberOfComponents
in interfaceProcess
- Returns:
- Returns the numberOfComponents.
-
getTimeDiscretization
- Specified by:
getTimeDiscretization
in interfaceProcess
- Returns:
- Returns the timeDiscretizationFromArray.
-
getTime
public double getTime(int timeIndex) -
getTimeIndex
public int getTimeIndex(double time)Description copied from interface:Process
Returns the time index for a given simulation time.- Specified by:
getTimeIndex
in interfaceProcess
- Parameters:
time
- The given simulation time.- Returns:
- Returns the time index for a given time
-
clone
Description copied from interface:Process
Create 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.
-