namespace fintech

// namespaces

namespace xf::fintech::blas
namespace xf::fintech::enums
namespace xf::fintech::internal

// enums

enum BusinessDayConvention
enum Compounding
enum Frequency
enum Type

// structs

template <typename DT>
struct stack_type

// classes

template <
    typename DT,
    typename Tree,
    int LEN2
    >
class BKModel

template <typename DT>
class BSModel

template <
    typename DT,
    int SZ
    >
class BrownianBridge

template <
    typename DT,
    typename Tree,
    int LEN2
    >
class CIRModel

template <
    typename DT,
    typename Tree,
    int LEN2
    >
class ECIRModel

template <
    typename DT,
    unsigned int _sizeMax
    >
class Fdm1dMesher

template <
    typename DT,
    typename Tree,
    int LEN2
    >
class G2Model

template <typename DT>
class G2Model <DT, void, 0>

template <typename DT>
class HWModel <DT, void, 0>

template <
    typename DT,
    typename Tree,
    int LEN2
    >
class HWModel

template <
    int ASSETS,
    typename DT
    >
class HestonModel <ASSETS, DT, enums::kDTQuadraticExponential>

template <
    int ASSETS,
    typename DT
    >
class HestonModel <ASSETS, DT, enums::kDTQuadraticExponentialMartingale>

template <
    int ASSETS,
    typename DT
    >
class HestonModel <ASSETS, DT, enums::kDTReflection>

template <
    int ASSETS,
    typename DT
    >
class HestonModel <ASSETS, DT, enums::kDTFullTruncation>

template <
    int ASSETS,
    typename DT
    >
class HestonModel <ASSETS, DT, enums::kDTPartialTruncation>

template <
    int ASSETS,
    typename DT,
    enums::DiscreType discrT
    >
class HestonModel

class MT19937
class MT19937BoxMullerNormalRng

template <>
class MT19937IcnRng <double>

template <typename mType>
class MT19937IcnRng

template <>
class MT19937IcnRng <float>

class MT2203

template <>
class MT2203IcnRng <float>

template <typename mType>
class MT2203IcnRng

template <>
class MT2203IcnRng <double>

template <
    typename _DT,
    int _VariatePairNum,
    int _BuffDepth
    >
class MultiVariateNormalRng

template <typename DT = double>
class OrnsteinUhlenbeckProcess

template <int DIM>
class SobolRsg

class SobolRsg1D

template <typename DT = double>
class StochasticProcess1D

template <
    typename DT,
    typename Model,
    typename Process,
    typename Instrument,
    int LEN,
    int LEN2
    >
class TreeLattice <DT, Model, Process, Instrument, 1, LEN, LEN2>

template <
    typename DT,
    typename Model,
    typename Process,
    typename Instrument,
    int DIM,
    int LEN,
    int LEN2
    >
class TreeLattice

template <
    typename DT,
    typename Model,
    typename Process,
    typename Instrument,
    int LEN,
    int LEN2
    >
class TreeLattice <DT, Model, Process, Instrument, 2, LEN, LEN2>

template <
    typename DT,
    typename Process,
    int LEN
    >
class TrinomialTree

template <
    typename DT,
    typename Tree,
    int LEN2
    >
class VModel

svd

#include "xf_fintech/jacobi_svd.hpp"
template <
    typename dataType,
    int diagSize
    >
void svd (
    dataType dataA [diagSize][diagSize],
    dataType sigma2 [diagSize][diagSize],
    dataType dataU_out2 [diagSize][diagSize],
    dataType dataV_out2 [diagSize][diagSize]
    )

Jacobi Singular Value Decomposition (SVD).

Parameters:

dataType data type.
diagSize matrix size.
dataA diagSize x diagSize matrix
sigma2 the decomposed diagonal matrix of dataA
dataU_out2 the left U matrix of dataA
dataV_out2 the right V matrix of dataA

mcSimulation

#include "xf_fintech/mc_simulation.hpp"
template <
    typename DT,
    typename RNG,
    typename PathGeneratorT,
    typename PathPricerT,
    typename RNGSeqT,
    int UN,
    int VariateNum,
    int SampNum
    >
DT mcSimulation (
    ap_uint <16> timeSteps,
    ap_uint <27> maxSamples,
    ap_uint <27> requiredSamples,
    DT requiredTolerance,
    PathGeneratorT pathGenInst [UN][1],
    PathPricerT pathPriInst [UN][1],
    RNGSeqT rngSeqInst [UN][1]
    )

Monte Carlo Framework implementation.

Parameters:

DT supported data type including double and float data type, which decides the precision of result, default double-precision data type.
RNG random number generator type.
PathGeneratorT path generator type which simulates the dynamics of the asset price.
PathPricerT path pricer type which calcualtes the option price based on asset price.
RNGSeqT random number sequence generator type.
UN number of Monte Carlo Module in parallel, which affects the latency and resources utilization.
VariateNum number of variate.
SampNum the total samples are divided into several steps, SampNum is the number for each step.
timeSteps number of the steps for each path.
maxSamples the maximum sample number. When reaching it, the simulation will stop.
requiredTolerance the tolerance required. If requiredSamples is not set, when reaching the required tolerance, simulation will stop.
requiredSamples the samples number required. When reaching the required number, simulation will stop.
pathGenInst instance of path generator.
pathPriInst instance of path pricer.
rngSeqInst instance of random number sequence.

pentadiagCr

#include "xf_fintech/pentadiag_cr.hpp"
template <
    typename T,
    unsigned int P_SIZE,
    unsigned int logN
    >
void pentadiagCr (
    T a [P_SIZE],
    T b [P_SIZE],
    T c [P_SIZE],
    T d [P_SIZE],
    T e [P_SIZE],
    T v [P_SIZE],
    T u [P_SIZE]
    )

Solves for u in linear system Pu = r

It calls function pentadiag_step for each step until all diagonals instead of main are zeros (or very close to zero). Result U is made by dividing Each of elements of right hand vactor ( v ) by main diagonal ( c )

Structure of input matrix:

c d e 0 0 |
b c d e 0 |
a b c d e |
0 a b c d |
0 0 a b c |.

Parameters:

T data type used in whole function (double by default)
P_SIZE Size of the operating matrix
logN Number of steps for algorithm
c Main diagonal
b First lower
a Second lower
d First upper
e Second upper
v Right hand side vector of length n
u Vectors of unknows to solve for

trap_integrate

#include "xf_fintech/quadrature.hpp"
template <typename DT>
static int trap_integrate (
    DT a,
    DT b,
    DT tol,
    DT* res,
    XF_USER_DATA_TYPE* p
    )

integration function using the adaptive trapezoidal technique

Parameters:

DT float or DT, determines the precision of the result
a lower limit of integration
b upper limit of integration
tol required tolerance of the result
res the result of the integration
p pointer to structure containing parameters for integrating function

Returns:

1 - success, 0 - fail (due to stack limitation)

simp_integrate

#include "xf_fintech/quadrature.hpp"
template <typename DT>
static int simp_integrate (
    DT a,
    DT b,
    DT tol,
    DT* res,
    XF_USER_DATA_TYPE* p
    )

integration function using the adaptive simpson 1/3 technique

Parameters:

DT float or DT, determines the precision of the result
a lower limit of integration
b upper limit of integration
tol required tolerance of the result
res the result of the integration
p pointer to structure containing parameters for integrating function

Returns:

1 - success, 0 - fail (due to stack limitation)

romberg_integrate

#include "xf_fintech/quadrature.hpp"
template <typename DT>
static int romberg_integrate (
    DT a,
    DT b,
    DT tol,
    DT* res,
    XF_USER_DATA_TYPE* p
    )

integration function using the romberg technique Based on https://en.wikipedia.org/wiki/Romberg%27s_method

Parameters:

DT float or DT, determines the precision of the result
a lower limit of integration
b upper limit of integration
tol required tolerance of the result
res the result of the integration
p pointer to structure containing parameters for integrating function

Returns:

1 - success, 0 - fail (due to stack limitation)

boxMullerTransform

#include "xf_fintech/rng.hpp"
template <typename mType>
void boxMullerTransform (
    mType u1,
    mType u2,
    mType& z1,
    mType& z2
    )

Box-Muller transform from uniform random number to normal random number.

Parameters:

mType data type
u1 first uniform random number input. Notice that it should not be zero.
u2 second uniform random number input
z1 first normal random number output
z2 second normal random number output

inverseCumulativeNormalPPND7

#include "xf_fintech/rng.hpp"
template <typename mType>
mType inverseCumulativeNormalPPND7 (mType input)

Inverse Cumulative transform from random number to normal random number.

Reference: Algorithm AS 241, The Percentage Points of the Normal Distribution by Michael J. Wichura.

Parameters:

mType data type.
input random number input.

Returns:

normal random number.

inverseCumulativeNormalAcklam

#include "xf_fintech/rng.hpp"
template <typename mType>
mType inverseCumulativeNormalAcklam (mType input)

Inverse CumulativeNormal using Acklam’s approximation to transform uniform random number to normal random number.

Reference: Acklam’s approximation: by Peter J. Acklam, University of Oslo, Statistics Division.

Parameters:

mType data type.
input input uniform random number

Returns:

normal random number

trsvCore

#include "xf_fintech/trsv.hpp"
template <
    class T,
    unsigned int N,
    unsigned int logN,
    unsigned int NCU
    >
void trsvCore (
    T inlow [N],
    T indiag [N],
    T inup [N],
    T inrhs [N]
    )

Tridiagonal linear solver It solves tridiagonal linear system of equations by eliminating upper and lower diagonals To get result (U) divide each element of inrhs by coresponding element of main diagonal indiag .

Parameters:

T data type
N matrix size
logN log2(N)(TOREMOVE)
NCU number of compute units
inlow lower diagonal
indiag diagonal
inup upper diagonal
inrhs right-hand side