# QuantLib_LatentModel_FactorSampler man page

LatentModel< copulaPolicyImpl >::FactorSampler< USNG, bool >

## Synopsis

`#include <ql/experimental/math/latentmodel.hpp>`

### Public Types

typedef **Sample**< std::vector< **Real** > > **sample_type**

### Public Member Functions

**FactorSampler** (const copulaType &copula, **BigNatural** seed=0)

const **sample_type** & **nextSequence** () const

## Detailed Description

### template<class copulaPolicyImpl>

template<class USNG, bool = true>

class QuantLib::LatentModel< copulaPolicyImpl >::FactorSampler< USNG, bool >" Allows generation or random samples of the latent variable.

Generates samples of all the factors in the latent model according to the given copula as random sequence. The default implementation given uses the inversion in the copula policy (which must be present). USNG is expected to be a uniform sequence generator in the default implementation.

## Member Function Documentation

### const sample_type& nextSequence () const

Returns a sample of the factor set $ M_kZ_i$. This method has the vocation of being specialized at particular types of the copula with a more efficient inversion to generate the random variables modelled (e.g. Box-Muller for a gaussian). Here a default implementation is provided based directly on the inversion of the cumulative distribution from the copula. Care has to be taken in potential specializations that the generator algorithm is compatible with an eventual concurrence of the simulations.

## Author

Generated automatically by Doxygen for QuantLib from the source code.

## Referenced By

FactorSampler(3) is an alias of QuantLib_LatentModel_FactorSampler(3).