Beispiel #1
0
int main(int argc, char **argv)
{
    long num = 1;

    while (numFactors(triNumber(num)) < 500)
        num++;

    printf("First number is %ld\n", triNumber(num));
    printf("Number of factors of %ld is %d\n", triNumber(num), numFactors(triNumber(num)));

    return 0;
}
Beispiel #2
0
        /*! The value of the latent variable Y_i conditional to
            (given) a set of values of the factors.

            The passed allFactors vector contains values for all the
            independent factors in the model (systemic and
            idiosyncratic, in that order). A full sample is required,
            i.e. all the idiosyncratic values are expected to be
            present even if only the relevant one is used.
        */
        Real latentVarValue(const std::vector<Real>& allFactors, 
                            Size iVar) const 
        {
            return std::inner_product(factorWeights_[iVar].begin(), 
                // systemic term:
                factorWeights_[iVar].end(), allFactors.begin(),
                // idiosyncratic term:
                allFactors[numFactors()+iVar] * idiosyncFctrs_[iVar]);
        }