Table of Contents

Class StochasticProcessArray

Namespace
NanoQL.Processes
Assembly
NanoQL.dll

An array of correlated one-dimensional stochastic processes.

public sealed class StochasticProcessArray : StochasticProcess
Inheritance
StochasticProcessArray
Inherited Members

Remarks

The correlation's pseudo square root is taken at construction by the spectral salvaging algorithm, as QuantLib's; each process evolves on its row of the correlated increments. The array's time is its first process's.

Constructors

StochasticProcessArray(ImmutableArray<StochasticProcess1D>, Matrix)

Initializes a new instance of the StochasticProcessArray class.

public StochasticProcessArray(ImmutableArray<StochasticProcess1D> processes, Matrix correlation)

Parameters

processes ImmutableArray<StochasticProcess1D>

The one-dimensional processes.

correlation Matrix

Their correlation matrix, symmetric, of the processes' number.

Exceptions

ArgumentException

The correlation matrix isn't square or is empty (PseudoSqrt(Matrix, SalvagingAlgorithmType)), there's no process, the matrix's size differs from the processes' number, or a process is null.

Properties

Size

Gets the number of dimensions of the process.

public override int Size { get; }

Property Value

int

Methods

Apply(Vector, Vector)

The changed state, each process applying its own element's change.

public override Vector Apply(Vector x0, Vector dx)

Parameters

x0 Vector

The state, one element per process.

dx Vector

The change, one element per process.

Returns

Vector

A new vector.

Exceptions

ArgumentException

x0 or dx holds fewer values than the processes, where QuantLib reads past its end.

Correlation()

The correlation the array's square root gives back, S·Sᵀ.

public Matrix Correlation()

Returns

Matrix

A new matrix.

Covariance(double, Vector, double)

The covariance: the standard deviation times its transpose.

public override Matrix Covariance(double t0, Vector x0, double dt)

Parameters

t0 double

The start of the interval.

x0 Vector

The state at its start, one element per process.

dt double

The interval's length.

Returns

Matrix

A new matrix.

Exceptions

ArgumentException

x0 holds fewer values than the processes, where QuantLib reads past its end.

Diffusion(double, Vector)

The diffusion: the correlation's square root, each row times its process's diffusion.

public override Matrix Diffusion(double t, Vector x)

Parameters

t double

The time.

x Vector

The state, one element per process.

Returns

Matrix

A new matrix.

Exceptions

ArgumentException

x holds fewer values than the processes, where QuantLib reads past its end.

Drift(double, Vector)

The drift part of the equation, μ(t, x_t).

public override Vector Drift(double t, Vector x)

Parameters

t double

The time.

x Vector

The state.

Returns

Vector

A new vector.

Exceptions

ArgumentException

x holds fewer values than the processes, where QuantLib reads past its end.

Evolve(double, Vector, double, Vector)

The state after a time interval: the increments correlated by the correlation's square root, each process evolved by its own.

public override Vector Evolve(double t0, Vector x0, double dt, Vector dw)

Parameters

t0 double

The start of the interval.

x0 Vector

The state at its start, one element per process.

dt double

The interval's length.

dw Vector

The independent Brownian increments, one per process.

Returns

Vector

A new vector.

Exceptions

ArgumentException

x0 holds fewer values than the processes, where QuantLib reads past its end.

Evolve(double, ReadOnlySpan<double>, double, ReadOnlySpan<double>, Span<double>)

The state after a time interval, written into the caller's span with nothing allocated: the allocating form's arithmetic, the correlated increments written row by row into result in the order of the matrix product, then each process evolved on its own entry in place.

public override void Evolve(double t0, ReadOnlySpan<double> x0, double dt, ReadOnlySpan<double> dw, Span<double> result)

Parameters

t0 double

The start of the interval.

x0 ReadOnlySpan<double>

The state at its start, one element per process.

dt double

The interval's length.

dw ReadOnlySpan<double>

The independent Brownian increments, one per process.

result Span<double>

The state at the interval's end, of the array's size at least; it mustn't overlap x0 or dw.

Exceptions

ArgumentException

dw's length isn't the correlation's.

Expectation(double, Vector, double)

The expectation E(x_{t0 + Δt} | x_{t0} = x0) of the process after a time interval Δt; by default, the discretization's drift applied to x0 by Apply(Vector, Vector).

public override Vector Expectation(double t0, Vector x0, double dt)

Parameters

t0 double

The start of the interval.

x0 Vector

The state at its start.

dt double

The interval's length.

Returns

Vector

A new vector.

Exceptions

NanoQLException

The process has no discretization.

ArgumentException

x0 holds fewer values than the processes, where QuantLib reads past its end.

InitialValues()

The initial values of the state variables.

public override Vector InitialValues()

Returns

Vector

A new vector.

InitialValues(Span<double>)

The initial values, each process's, written into the caller's span; nothing is allocated.

public override void InitialValues(Span<double> result)

Parameters

result Span<double>

The values, of the array's Size at least.

Exceptions

ArgumentException

result is shorter than the array.

Process(int)

The i-th process.

public StochasticProcess1D Process(int i)

Parameters

i int

The index.

Returns

StochasticProcess1D

The process.

Exceptions

ArgumentOutOfRangeException

i isn't one of the processes, where QuantLib reads past its end.

StdDeviation(double, Vector, double)

The standard deviation: the correlation's square root, each row times its process's standard deviation.

public override Matrix StdDeviation(double t0, Vector x0, double dt)

Parameters

t0 double

The start of the interval.

x0 Vector

The state at its start, one element per process.

dt double

The interval's length.

Returns

Matrix

A new matrix.

Exceptions

ArgumentException

x0 holds fewer values than the processes, where QuantLib reads past its end.

Time(Date)

The time a date denotes: the first process's.

public override double Time(Date date)

Parameters

date Date

The date.

Returns

double

The time.

Exceptions

ArgumentException

date is default(Date).

NanoQLException

The first process doesn't convert dates to times.