namespace internal

// structs

template <typename DT>
struct complex_num

// classes

template <
    typename DT,
    typename DT_EQ_TYPE,
    unsigned int N,
    unsigned int M
    >
class FdBsLvSolverWrapper

template <
    typename DT,
    unsigned int MAX_TENORS,
    unsigned MAX_CURVES,
    unsigned NCU
    >
class HJMPcaEngine

template <
    typename DT,
    unsigned int M_SIZE,
    unsigned int LOG2_M_SIZE,
    unsigned int A_SIZE,
    unsigned int MEM_WIDTH,
    unsigned int DIM2_SIZE1 = 3,
    unsigned int DIM2_SIZE2 = 5
    >
class Solver

template <
    typename DT,
    unsigned int MEM_WIDTH,
    unsigned int INDEX_WIDTH,
    unsigned int A_SIZE,
    unsigned int M_SIZE,
    unsigned int LOG2_M_SIZE,
    unsigned int DIM2_SIZE1 = 3,
    unsigned int DIM2_SIZE2 = 5
    >
class StreamWrapper

phi

#include "xf_fintech/cf_b76.hpp"
template <typename DT>
DT phi (DT xin)

Approximation to Normal CDF.

This is an implentation of the Abramowitz and Stegun approximation. Refer to https://en.wikipedia.org/wiki/Error_function under the Numerical Approximations section.

Parameters:

DT Data Type used for this function
xin variable

Returns:

Normal CDF of input variable

V2S

#include "xf_fintech/fd_solver.hpp"
unsigned int V2S (
    const unsigned int index,
    const unsigned int m1,
    const unsigned int m2
    )

Get V-inner index from an S ordered vector.

S2V

#include "xf_fintech/fd_solver.hpp"
unsigned int S2V (
    const unsigned int index,
    const unsigned int m1,
    const unsigned int m2
    )

Get S-inner index from an V ordered vector.

charFunc

#include "xf_fintech/hcf_engine.hpp"
template <typename DT>
struct complex_num <DT> charFunc (
    struct hcfEngineInputDataType <DT>* in,
    struct complex_num <DT> w
    )

function to calculate the characteristic function

Parameters:

in A structure containing the kerenl model parameters
w complex representation of w

Returns:

the calculated characterisic function value

pi1Integrand

#include "xf_fintech/hcf_engine.hpp"
template <typename DT>
DT pi1Integrand (
    struct hcfEngineInputDataType <DT>* in,
    DT w
    )

function to calculate the integrand for pi 1

Parameters:

in A structure containing the kerenl model parameters
w the limit

Returns:

the calculated integrand value

pi2Integrand

#include "xf_fintech/hcf_engine.hpp"
template <typename DT>
DT pi2Integrand (
    struct hcfEngineInputDataType <DT>* in,
    DT w
    )

function to calculate the integrand for pi 2

Parameters:

in A structure containing the kerenl model parameters
w the limit

Returns:

the calculated integrand value

integrateForPi1

#include "xf_fintech/hcf_engine.hpp"
template <typename DT>
DT integrateForPi1 (struct hcfEngineInputDataType <DT>* in)

integration function pi 1

Parameters:

in A structure containing the kerenl model parameters

Returns:

the calculated value

integrateForPi2

#include "xf_fintech/hcf_engine.hpp"
template <typename DT>
DT integrateForPi2 (struct hcfEngineInputDataType <DT>* in)

integration function pi 1

Parameters:

in A structure containing the kerenl model parameters

Returns:

the calculated value

sum

#include "xf_fintech/m76_engine.hpp"
template <typename DT>
void sum (
    DT* out,
    DT* in
    )

Summing loop for the individual BS solutions.

Parameters:

in An array of the individual solutions
out The sum

TargetDist

#include "xf_fintech/pop_mcmc.hpp"
template <typename DT>
DT TargetDist (
    DT x,
    DT temp_inv
    )

Calculates target distribution density for a given sample and temperature. Calculated density is raised to power of temperature of target chain.

Parameters:

DT data type used in whole function (double by default)
x
  • Sample to generate density for
temp_inv
  • Inverted temperature of the chain that density is generate for (1/Temp)

Returns:

Calculated density

GaussTransform

#include "xf_fintech/pop_mcmc.hpp"
template <typename DT>
DT GaussTransform (
    DT in,
    DT mu,
    DT sigma
    )

Calculates final transformation of Gaussian Sample.

Parameters:

DT Data type used in whole function (double by default)
in
  • Sample from Uniform Distribution
mu
  • Expected value for Normal Distribution
sigma
  • Sigma for Proposal generation

Returns:

  • Generated Sample

ProbEval

#include "xf_fintech/pop_mcmc.hpp"
template <
    typename DT,
    unsigned int NCHAINS
    >
void ProbEval (
    DT chain_in [NCHAINS],
    hls::stream <DT>& chain_out,
    DT gauss [NCHAINS],
    DT gauss_next [NCHAINS],
    xf::fintech::MT19937& uniformRNG,
    DT temp_inv [NCHAINS],
    DT sigma [NCHAINS]
    )

Probability evaluation function.

It Generates samples for all chains. Metropolis sampler is used in this function.

Fully pipelined for chains.

During Probability evaluation gauss sample for next sample is generated in parallel,

this allows to save half of the time for probability evaluation.

Part of the dataflow streaming region.

Parameters:

DT data type used in whole function (double by default)
NCHAINS Number of chains
chain_in
  • Previous samples for each chains
gauss
  • Gaussian sample proposal on [0:1] for current sample (1/Temp)
gauss_next
  • Gaussian sample proposal on [0:1] for next sample
chain_out
  • Samples streaming output
uniformRNG
  • Pointer to Uniform RNG for Accept/Reject
temp_inv
  • Array of Inverted temperatures of the chain that density is generate for (1/Temp)
sigma
  • Array of sigmas for Proposal generation for each chain

ChainExchange

#include "xf_fintech/pop_mcmc.hpp"
template <
    typename DT,
    unsigned int NCHAINS
    >
void ChainExchange (
    hls::stream <DT>& chain_in,
    DT chain_out [NCHAINS],
    DT temp_inv [NCHAINS]
    )

Chain Exchange function.

Calculates exchange ratio and exchanges chains if needed.

Fully pipelined for chains.

Part of the dataflow streaming region.

Parameters:

DT data type used in whole function (double by default)
NCHAINS Number of chains
chain_in
  • Current sample streaming input interface
chain_out
  • Array of generated samples for each chain samples.
temp_inv
  • Array of Inverted temperatures of the chain that density is generate for (1/Temp)

SampleEval

#include "xf_fintech/pop_mcmc.hpp"
template <
    typename DT,
    unsigned int NCHAINS
    >
void SampleEval (
    DT chain [NCHAINS],
    DT chain_out [NCHAINS],
    DT gauss [NCHAINS],
    DT gauss_next [NCHAINS],
    xf::fintech::MT19937& uniformRNG,
    DT temp_inv [NCHAINS],
    DT sigma [NCHAINS]
    )

Wraping function for dataflow region. /n.

Parameters:

DT data type used in whole function (double by default)
NCHAINS Number of chains
chain
  • Previous samples for each chains
gauss
  • Gaussian sample proposal on [0:1] for current sample (1/Temp)
gauss_next
  • Gaussian sample proposal on [0:1] for next sample
chain_out
  • Array of generated samples
uniformRNG
  • Pointer to Uniform RNG for Accept/Reject
temp_inv
  • Array of Inverted temperatures of the chain that density is generate for (1/Temp)
sigma
  • Array of sigmas for Proposal generation for each chain