 		printf("%f\n", sample_mean_res[i]);
 	}
 	write_paths_to_csv("maxent_samples.csv", samples_res, nsamps_tot, N, "w");
+	write_paths_to_csv("maxent_cov.csv", sample_covariance_res, N, N, "w");
 
 
 	/* free memory */

	float *alpha_res = (float*)malloc(mean_size);
	float *beta_res = (float*)malloc(cov_size);
	float *sample_mean_res = (float*)malloc(mean_size);
	float *samples_res = (float*)malloc(samples_size);

	/* Allocate device memory */

	sample_mean[cell] = sample_mean[cell] / nsamps;
}

__global__ void compute_sample_covariance(float* samples, float* sample_covariance, int nsamps, int N)
{
	int i = blockIdx.x;
	int j = threadIdx.x;
	sample_covariance[i*N + j] = 0.0;
	for(int samp = 0; samp<nsamps; samp++)
	{
		sample_covariance[i*N+j] += samples[samp*N+i]*samples[samp*N+j];
	}
	sample_covariance[i*N+j] = sample_covariance[i*N+j]/nsamps;

}


__global__ void update_parameter_estimates(float* alpha, float* beta, float* sample_mean, float* sample_covariance, int N)
{
