     
     // Cholesky factor of proposal distribution for each data point, used by the Metropolis algorithm. The proposal
     // covariance matrix for each data point is Covar_i = PropChol_i * transpose(PropChol_i).
-    dim_cholfactor = p * p - ((p - 1) * p) / 2; // cholesky factor is a lower-diagonal matrix
     thrust::host_vector<double> h_prop_cholfact(n * dim_cholfactor);
     thrust::fill(h_prop_cholfact.begin(), h_prop_cholfact.end(), 0.0);
     

	{
        // Copy variables to local memory for efficiency
        curandState localState = state[i];
        dim_cholfactor = c_p * c_p - ((c_p - 1) * c_p) / 2;  // cholesky factor is a lower-diagonal matrix
        double cholfactor[dim_cholfactor];
        for (int j=0; j<dim_cholfactor; j++) {
            cholfactor[j] = prop_cholfact[n * j + i];
        }

        // get the unit proposal
        double snorm_deviate[c_p];
        for (int j=0; j<c_p; j++) {
            snorm_deviate[j] = curand_normal_double(&localState);
        }
        
        // propose a new chi value
        double new_chi[c_p];
        double scaled_proposal[c_p]
        cholfact_index = 0
        for (int j=0; j<c_p; j++) {
            double scaled_proposal_j = 0.0;
            for (int k=0; k<(j+1); k++) {

     collection of the mean and variances of the normal distributions.
    */
    
    int n = 10000; // # of data points
    
    double mu_norm = 8.5 * log(10);  // Average value of the natural logarithm of the SED normalization
    double sig_norm = 0.5 * log(10);  // Standard deviation in the SED normalization
