#include "xf_fintech/mc_engine.hpp"
template < typename DT = double, int UN = 2 > void MCAmericanEnginePreSamples ( DT underlying, DT volatility, DT riskFreeRate, DT dividendYield, DT timeLength, DT strike, bool optionType, ap_uint <32>* seed, ap_uint <8*sizeof (DT)*UN>* priceOut, ap_uint <8*sizeof (DT)>* matOut, unsigned int calibSamples = 4096, unsigned int timeSteps = 100 )
American Option Pricing Engine using Monte Carlo Method. PreSample kernel: this kernel samples some amount of path and store them to external memory.
Parameters:
| DT | supported data type including double and float data type, which decides the precision of result, default double-precision data type. |
| UN | number of Monte Carlo Module in parallel (in path dimension), which affects the latency and resources utilization, default 2. |
| underlying | intial value of underlying asset at time 0. |
| volatility | fixed volatility of underlying asset. |
| dividendYield | the constant dividend rate for continuous dividends. |
| riskFreeRate | risk-free interest rate. |
| timeLength | the time length of contract from start to end. |
| strike | the strike price also known as exericse price, which is settled in the contract. |
| optionType | option type. 1: put option, 0: call option. |
| seed | array to store the inital seed for each RNG. |
| priceOut | price data output, the data can be stored to HBM or DDR |
| matOut | matrix output, the data can be stored to HBM or DDR |
| calibSamples | sample numbers that used in calibration, default 4096. |
| timeSteps | the number of discrete steps from 0 to T, T is the expiry time, default 100. |