RNG¶
Defined in <xf_fintech/rng.hpp>¶
class MT19937 class MT2203 class MT19937IcnRng class MT19937BoxMullerNomralRng class MT2203IcnRng class MultiVariateNormalRng
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
OrnsteinUhlenbeckProcess¶
Defined in <xf_fintech/ornstein_uhlenbeck_process.hpp>¶
class OrnsteinUhlenbeckProcess
StochasticProcess1D¶
Defined in <xf_fintech/stochastic_process.hpp>¶
class StochasticProcess1D
HestonModel¶
Defined in <xf_fintech/heston_model.hpp>¶
class HestonModel
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:
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 |