         double* p_meas = thrust::raw_pointer_cast(&d_meas[0]);
         double* p_meas_unc = thrust::raw_pointer_cast(&d_meas_unc[0]);
         double* p_chi = thrust::raw_pointer_cast(&d_chi[0]);
-        double* p_prop_cholfact = thrust::raw_pointer_cast(&d_prop_cholfact[0]);
+        double* p_prop_cholfact = thrust::raw_pointer_cast(&d_chi_cholfactor[0]);
         double* p_logdens = thrust::raw_pointer_cast(&d_logdens[0]);
         int current_iter = i + 1;
         update_chi<<<nBlocks,nThreads>>>(p_chi, p_meas, p_meas_unc, ndata, p_logdens, p_prop_cholfact, devStates, current_iter);

        return 2;
    }

    curandState* devStates;  // Create state object for random number generators on the GPU
    // Allocate memory on GPU for RNG states
    CUDA_CALL(cudaMalloc((void **)&devStates, nThreads.x * nBlocks.x *

	}
}

// Initialize the chi and theta values. Right now this just initializes them to their true values. Also initialize the Cholesky factors
// for the chi and theta proposals. The elements of the chi and theta proposals are initially independent.
void initialize_parameters(int ndata, thrust::host_vector<double>& theta, thrust::host_vector<double>& chi,
		thrust::host_vector<double>& theta_cholfactor, thrust::host_vector<double>& chi_cholfactor, thrust::host_vector<double>& true_chi) {

	// Initalize the chi values to their true values for now
	thrust::copy(true_chi.begin(), true_chi.end(), chi.begin());

	// Initialize the cholesky factor for the theta proposals
    int diag_index = 0;
    for (int j=0; j<dim_theta; j++) {
    	// Initialize the covariance matrix of the theta proposal distribution to be 0.01 * identity(p)
        theta_cholfactor[j] = 1e-2;
        diag_index += j + 2;
    }

    // Initialize the cholesky factor for the chi proposals
    for (int i=0; i<ndata; i++) {
        int diag_index = 0;
        for (int j=0; j<p; j++) {
        	// Initialize the covariance matrix of the chi proposal distribution to be 0.01 * identity(p)
        	chi_cholfactor[i + ndata * diag_index] = 0.01;
        	diag_index += j + 2;
        }
    }
}

int main(void)
{
    /* TODO: Should use the boost random number generator libraries for doing this on the host */
