RNG

Defined in <xf_fintech/rng.hpp>

class MT19937
class MT2203
class MT19937IcnRng
class MT19937BoxMullerNomralRng
class MT2203IcnRng
class MultiVariateNormalRng

XoShiRo128

Defined in <xf_fintech/xoshiro128.hpp>

class XoShiRo128PlusPlus
class XoShiRo128Plus
class XoShiRo128StarStar

SobolRsg

Defined in <xf_fintech/sobol_rsg.hpp>

class SobolRsg
class SobolRsg1D

BrownianBridge

Defined in <xf_fintech/brownian_bridge.hpp>

class BrownianBridge

TrinomialTree

Defined in <xf_fintech/trinomial_tree.hpp>

class TrinomialTree

TreeLattice

Defined in <xf_fintech/tree_lattice.hpp>

class TreeLattice

1DMesher

Defined in <xf_fintech/fdmmesher.hpp>

class 1DMesher

OrnsteinUhlenbeckProcess

Defined in <xf_fintech/ornstein_uhlenbeck_process.hpp>

class OrnsteinUhlenbeckProcess

StochasticProcess1D

Defined in <xf_fintech/stochastic_process.hpp>

class StochasticProcess1D

HWModel

Defined in <xf_fintech/hw_model.hpp>

class HWModel

G2Model

Defined in <xf_fintech/g2_model.hpp>

class G2Model

ECIRModel

Defined in <xf_fintech/ecir_model.hpp>

class ECIRModel

CIRModel

Defined in <xf_fintech/cir_model.hpp>

class CIRModel

VModel

Defined in <xf_fintech/v_model.hpp>

class VModel

HestonModel

Defined in <xf_fintech/heston_model.hpp>

class HestonModel

BKModel

Defined in <xf_fintech/bk_model.hpp>

class BKModel

BSModel

Defined in <xf_fintech/bs_model.hpp>

class BSModel

PCA

Defined in <xf_fintech/pca.hpp>

class PCA

BicubicSplineInterpolation

Defined in <xf_fintech/bicubic_spline_interpolation.hpp>

class BicubicSplineInterpolation

CubicInterpolation

Defined in <xf_fintech/cubic_interpolation.hpp>

class CubicInterpolation

BinomialDistribution

Defined in <xf_fintech/binomial_distribution.hpp>

class BinomialDistribution

bernoulliPMF

#include "xf_fintech/bernoulli_distribution.hpp"
template <typename DT>
DT bernoulliPMF (
    int k,
    DT p
    )

bernoulliPMF it implement a probability mass function for bernoulli distribution

Parameters:

DT data type supported include float and double
k k successes in 1 independent Bernoulli trial
p p is the probability of success of a single trial.

Returns:

it belong to [0, 1] and also is a probability value.

bernoulliCDF

#include "xf_fintech/bernoulli_distribution.hpp"
template <typename DT>
DT bernoulliCDF (
    int k,
    DT p
    )

bernoulliCDF it implement a cumulative distribution function for bernoulli distribution

Parameters:

DT data type supported include float and double
k k successes in 1 independent Bernoulli trial
p p is the probability of success of a single trial.

Returns:

it belong to [0, 1] and also is a cumulative probability value.

covCoreMatrix

#include "xf_fintech/covariance.hpp"
template <
    typename DT,
    int N,
    int M,
    int U,
    int V
    >
void covCoreMatrix (
    int rows,
    int cols,
    DT inMatrix [N][M],
    DT outCovMatrix [N][N]
    )

covCoreMatrix calculate the covariance of the input matrix.

Parameters:

DT data type supported include float and double
N maximum supported row
M maximum supported column
U unroll the 1-d inMatrix to improve throughput, support 4, 8, 16
V unroll the 2-d inMatrix to improve throughput, support 1, 2, 4, 8
rows actual row number
cols actual column number
inMatrix input cols x rows matrix
outCovMatrix output rows x rows covariance matrix

covCoreStrm

#include "xf_fintech/covariance.hpp"
template <
    typename DT,
    int DTLEN,
    int N,
    int M,
    int TI,
    int TO
    >
void covCoreStrm (
    int rows,
    int cols,
    hls::stream <ap_uint <DTLEN*TI>>& inMatStrm,
    hls::stream <ap_uint <DTLEN*TO>>& outCovStrm
    )

covCoreStrm calculate the covariance of the input matrix, the input matrix input in the order of the columns by stream, the output covariance matrix output in the order of the rows by stream.

Parameters:

DT data type supported include float and double
DTLEN length of DT
N maximum supported row
M maximum supported column
TI the bit-width of input stream is TI * DTLEN
TO the bit-width of output stream is TO * DTLEN
rows actual row number
cols actual column number
inMatStrm according to stream way to input cols x rows matrix in the order of the columns
outCovStrm according to stream way to output rows x rows covariance matrix in the order of the rows

covReHardThreshold

#include "xf_fintech/covariance_regularization.hpp"
template <typename DT>
void covReHardThreshold (
    int n,
    DT threshold,
    hls::stream <DT>& inMatStrm,
    hls::stream <DT>& outMatStrm
    )

covReHardThreshold hard-thresholding Covariance Regularization

Parameters:

DT data type supported include float and double
n n x n covariance matrix
threshold hard-thresholding parameter
inMatStrm a covariance matrix
outMatStrm a regularized covariance matrix after hard-thresholding operation

covReSoftThreshold

#include "xf_fintech/covariance_regularization.hpp"
template <typename DT>
void covReSoftThreshold (
    int n,
    DT threshold,
    hls::stream <DT>& inMatStrm,
    hls::stream <DT>& outMatStrm
    )

covReSoftThreshold soft-thresholding Covariance Regularization

Parameters:

DT data type supported include float and double
n n x n covariance matrix
threshold soft-thresholding parameter
inMatStrm a covariance matrix
outMatStrm a regularized covariance matrix after soft-thresholding operation

covReBand

#include "xf_fintech/covariance_regularization.hpp"
template <typename DT>
void covReBand (
    int n,
    int k,
    hls::stream <DT>& inMatStrm,
    hls::stream <DT>& outMatStrm
    )

covReBand banding Covariance Regularization

Parameters:

DT data type supported include float and double
n n x n covariance matrix
k banding parameter
inMatStrm a covariance matrix
outMatStrm a regularized covariance matrix after banding operation

covReTaper

#include "xf_fintech/covariance_regularization.hpp"
template <typename DT>
void covReTaper (
    int n,
    int l,
    DT h,
    hls::stream <DT>& inMatStrm,
    hls::stream <DT>& outMatStrm
    )

covReTaper tapering Covariance Regularization

Parameters:

DT data type supported include float and double
n n x n covariance matrix
l tapering parameter
h the ratio between taper l_h and parameter l
inMatStrm a covariance matrix
outMatStrm a regularized covariance matrix after tapering operation

gammaCDF

#include "xf_fintech/gamma_distribution.hpp"
template <typename DT>
DT gammaCDF (
    DT a,
    DT x
    )

gammaCDF it implement a cumulative distribution function for gamma distribution

Parameters:

DT data type supported include float and double
a is a positive real number
x is a positive real number

Returns:

it belong to [0, 1] and also is a cumulative probability value.

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

linearImpl

#include "xf_fintech/linear_interpolation.hpp"
template <typename DT>
DT linearImpl (
    DT x,
    int len,
    DT* arrX,
    DT* arrY
    )

linearImpl 1D linear interpolation

Parameters:

DT data type supported include float and double.
x interpolation coordinate x
len array of length
arrX array of coordinate x
arrY array of coordinate y

Returns:

return interpolation coordinate y

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.

normalPDF

#include "xf_fintech/normal_distribution.hpp"
template <typename DT>
DT normalPDF (
    DT average,
    DT sigma,
    DT x
    )

normalPDF it implement a probability density function for normal distribution

Parameters:

DT data type supported include float and double
average the expected value of the distribution
sigma the standard deviation of the distribution
x input of the distribution

Returns:

return the result of normal distribution

normalCDF

#include "xf_fintech/normal_distribution.hpp"
template <typename DT>
DT normalCDF (
    DT average,
    DT sigma,
    DT x
    )

normalCDF it implement a cumulative distribution function for normal distribution

Parameters:

DT data type supported include float and double
average the expected value of the distribution
sigma the standard deviation of the distribution
x input of the distribution

Returns:

return the result of normal distribution

normalICDF

#include "xf_fintech/normal_distribution.hpp"
template <typename DT>
DT normalICDF (
    DT average,
    DT sigma,
    DT y
    )

normalICDF it implement a inverse cumulative distribution function for normal distribution

Parameters:

DT data type supported include float and double
average the expected value of the distribution
sigma the standard deviation of the distribution
y input of the distribution

Returns:

return the result of normal distribution

logNormalPDF

#include "xf_fintech/normal_distribution.hpp"
template <typename DT>
DT logNormalPDF (
    DT average,
    DT sigma,
    DT x
    )

logNormalPDF it implement a probability density function for log-normal distribution

Parameters:

DT data type supported include float and double
average the expected value of the distribution
sigma the standard deviation of the distribution
x input of the distribution

Returns:

return the result of log-normal distribution

logNormalCDF

#include "xf_fintech/normal_distribution.hpp"
template <typename DT>
DT logNormalCDF (
    DT average,
    DT sigma,
    DT x
    )

logNormalCDF it implement a cumulative distribution function for log-normal distribution

Parameters:

DT data type supported include float and double
average the expected value of the distribution
sigma the standard deviation of the distribution
x input of the distribution

Returns:

return the result of log-normal distribution

logNormalICDF

#include "xf_fintech/normal_distribution.hpp"
template <typename DT>
DT logNormalICDF (
    DT average,
    DT sigma,
    DT y
    )

logNormalICDF it implement a inverse cumulative distribution function for log-normal distribution

Parameters:

DT data type supported include float and double
average the expected value of the distribution
sigma the standard deviation of the distribution
y input of the distribution

Returns:

return the result of log-normal distribution

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

poissonPMF

#include "xf_fintech/poisson_distribution.hpp"
template <typename DT>
DT poissonPMF (
    unsigned int k,
    DT m
    )

poissonPMF it implement a probability mass function for poisson distribution

Parameters:

DT data type supported include float and double
k the number of occurrences
m is a positive real number, it is equal to the expected value of a discrete random variable and also to its variance.

Returns:

it belong to [0, 1] and also is a probability value.

poissonCDF

#include "xf_fintech/poisson_distribution.hpp"
template <typename DT>
DT poissonCDF (
    unsigned int k,
    DT m
    )

poissonCDF it implement a cumulative distribution function for poisson distribution

Parameters:

DT data type supported include float and double
k the number of occurrences
m is a positive real number, it is equal to the expected value of a discrete random variable and also to its variance.

Returns:

it belong to [0, 1] and also is a cumulative probability value.

poissonICDF

#include "xf_fintech/poisson_distribution.hpp"
template <typename DT>
int poissonICDF (
    DT m,
    DT x
    )

poissonICDF it implement a inverse cumulative distribution function for poisson distribution

Parameters:

DT data type supported include float and double
m is a positive real number, it is equal to the expected value of a discrete random variable and also to its variance.
x belong to [0, 1] and also is a cumulative probability value.

Returns:

the number of occurrences.

polyfit

#include "xf_fintech/polyfit.hpp"
template <
    typename DT,
    unsigned int D,
    unsigned int MAX_WIDTH
    >
void polyfit (
    const DT evalX [MAX_WIDTH],
    const DT evalPoints [MAX_WIDTH],
    unsigned int sizeEval,
    DT coefficients [D]
    )

Calculates the polynomial fitting to the D degree of the discrete set of points in ‘evalPoints’.

Parameters:

DT  
: The data type of the points
D  
: The degree of the polynomial that will approximate the set of points.
MAX_WIDTH  
: The maximum synthetisable amount of discrete points.
evalX  
: values on the X axis of the set of points.
evalPoints  
: Set of points to be approximated.
sizeEval  
: Length of ‘evalPoints’, must be <= MAX_WIDTH
coefficients  
: Output polynomial coefficients that approximate ‘evalPoints’ to the D degree, in decreasing order of degree.
#include "xf_fintech/polyfit.hpp"
template <
    typename DT,
    unsigned int D,
    unsigned int MAX_WIDTH
    >
void polyfit (
    const DT evalPoints [MAX_WIDTH],
    const unsigned int sizeEval,
    DT coefficients [D]
    )

Calculates the polynomial fitting to the D degree of the discrete set of points in ‘evalPoints’, assuming values on the X axis = [0, 1, 2, 3, …, MAX_WIDTH].

Parameters:

DT  
: The data type of the points
D  
: The degree of the polynomial that will approximate the set of points.
MAX_WIDTH  
: The maximum synthetisable amount of discrete points.
evalPoints  
: Set of points to be approximated.
sizeEval  
: Length of ‘evalPoints’, must be <= MAX_WIDTH
coefficients  
: Output polynomial coefficients that approximate ‘evalPoints’ to the D degree, in decreasing order of degree.

polyval

#include "xf_fintech/polyfit.hpp"
template <
    typename DT,
    unsigned int D
    >
DT polyval (
    const DT coeff [D],
    const DT x
    )

Calculates the polynomial evaluation of a set of coefficients at the point ‘x’.

Parameters:

DT  
: The data type to be used.
D  
: The degree of the polynomial
coeff  
: The list of polynomial coefficients calculated with polyfit.
x  
: The point at which the polynomial should be evaluated.

polyint

#include "xf_fintech/polyfit.hpp"
template <
    typename DT,
    unsigned int D
    >
void polyint (
    DT pf [D],
    DT pfInt [D+1],
    DT c = 0.0
    )

Performs the definite integral of a polynomial fitted function defined by its coefficients.

Parameters:

DT  
: The data type to be used.
D  
: The degree of the fitted original polynomial.
pf  
: The original polyfitted coefficients vector to be integrated.
pfInt  
: Output vector containing the definite integral of the original polynomial. Note that it’s length must be 1 more than the original polynomial to hold the extra degree.
c  
: Constant term of the new integral, defaults to 0.

polyder

#include "xf_fintech/polyfit.hpp"
template <
    typename DT,
    unsigned int D
    >
void polyder (
    DT pf [D],
    DT pfDer [D-1]
    )

Performs the first derivate of a polynomial fitted function defined by its coefficients.

Parameters:

DT  
: The data type to be used.
D  
: The degree of the fitted original polynomial
pf  
: The original polyfitted coefficients vector to be integrated.
pfDer  
: Output vector containing the derivate of the original polynomial. Note that it’s length must be 1 fewer than the original polynomial.

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