Base class for latent model monte carlo simulation. Independent of the
copula type and the generator.
Generates the factors and variable samples and determines event threshold
but it is not responsible for actual event specification; thats the derived
classes responsibility according to what they model.
Derived classes need mainly to implement nextSample (Worker::nextSample in
the multithreaded version) to compute the simulation event generated, if
any, from the latent variables sample. They also have the accompanying
event trait to specify.
CRTP used for performance to avoid virtual table resolution in the Monte
Carlo. Not only in sample generation but access; quite an amount of time can
go into statistics computation, for a portfolio of tens of thousands
positions that part of the problem will be starting to overtake the
simulation costs.
todo:
someone with sound experience on cache misses look into this, the
statistics will be getting memory in and out of the cpu heavily and it
might be possible to get performance out of that.
todo:
parallelize the statistics computation, things like Var/ESF splits
are very expensive.
todo:
consider another design, taking the statistics outside the models.
Base class for latent model monte carlo simulation. Independent of the copula type and the generator. Generates the factors and variable samples and determines event threshold but it is not responsible for actual event specification; thats the derived classes responsibility according to what they model. Derived classes need mainly to implement nextSample (Worker::nextSample in the multithreaded version) to compute the simulation event generated, if any, from the latent variables sample. They also have the accompanying event trait to specify.
CRTP used for performance to avoid virtual table resolution in the Monte Carlo. Not only in sample generation but access; quite an amount of time can go into statistics computation, for a portfolio of tens of thousands positions that part of the problem will be starting to overtake the simulation costs.
someone with sound experience on cache misses look into this, the statistics will be getting memory in and out of the cpu heavily and it might be possible to get performance out of that.
parallelize the statistics computation, things like Var/ESF splits are very expensive.
consider another design, taking the statistics outside the models.