net.finmath.montecarlo.model.AbstractModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finmath-lib Show documentation
Show all versions of finmath-lib Show documentation
finmath lib is a Mathematical Finance Library in Java.
It provides algorithms and methodologies related to mathematical finance.
package net.finmath.montecarlo.model; import net.finmath.exception.CalculationException; import net.finmath.montecarlo.process.AbstractProcessInterface; import net.finmath.stochastic.RandomVariableInterface; import net.finmath.time.TimeDiscretizationInterface; /** * This class is an abstract base class to implement a model provided to an AbstractProcess. * * Manages the delegation to AbstractProcessInterface. * * For details see {@link net.finmath.montecarlo.model.AbstractModelInterface}. * * @author Christian Fries * @see AbstractModelInterface The interface definition contains more details. * @version 1.3 */ public abstract class AbstractModel implements AbstractModelInterface { private AbstractProcessInterface process; /** * Returns the initial value of the model. * * @return The initial value of the model. */ public RandomVariableInterface[] getInitialValue() { RandomVariableInterface[] initialState = getInitialState(); RandomVariableInterface[] value = new RandomVariableInterface[initialState.length]; for(int i= 0; i
method. * @see net.finmath.montecarlo.process.AbstractProcess#getProcessValue(int, int) */ public RandomVariableInterface getProcessValue(int timeIndex, int componentIndex) throws CalculationException { return process.getProcessValue(timeIndex, componentIndex); } /** * @param timeIndex The time index of evaluation time (using this models time discretization) * @return A random variable representing the Monte-Carlo probabilities. * @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via thecause() cause()
method. * @see net.finmath.montecarlo.process.AbstractProcess#getMonteCarloWeights(int) */ public RandomVariableInterface getMonteCarloWeights(int timeIndex) throws CalculationException { return process.getMonteCarloWeights(timeIndex); } /** * Get the time discretization of the model (simulation time). * @return The time discretization of the model (simulation time). * @see net.finmath.montecarlo.process.AbstractProcess#getTimeDiscretization() */ public final TimeDiscretizationInterface getTimeDiscretization() { return process.getTimeDiscretization(); } /** * Return the simulation time for a given time index. * @param timeIndex Time index * @return Returns the time for a given time index. * @see net.finmath.montecarlo.process.AbstractProcess#getTime(int) */ public final double getTime(int timeIndex) { return process.getTime(timeIndex); } /** * Return the time index associated for the given simulation time. * @param time A given time. * @return The time index corresponding to the given time. * @see net.finmath.montecarlo.process.AbstractProcess#getTimeIndex(double) */ public final int getTimeIndex(double time) { return process.getTimeIndex(time); } }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy