forked from personal/squiggle.c
		
	formatting pass
This commit is contained in:
		
							parent
							
								
									ef40ef5ae7
								
							
						
					
					
						commit
						84399e60a2
					
				|  | @ -1,6 +1,6 @@ | ||||||
| #include "../../squiggle.h" | #include "../../squiggle.h" | ||||||
| #include <stdint.h> |  | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  | #include <stdint.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| 
 | 
 | ||||||
|  | @ -34,7 +34,8 @@ double probability_of_dying_eli(uint64_t* seed) | ||||||
|     return probability_of_dying; |     return probability_of_dying; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| double mixture(uint64_t* seed){ | double mixture(uint64_t* seed) | ||||||
|  | { | ||||||
|     double (*samplers[])(uint64_t*) = { probability_of_dying_nuno, probability_of_dying_eli }; |     double (*samplers[])(uint64_t*) = { probability_of_dying_nuno, probability_of_dying_eli }; | ||||||
|     double weights[] = { 0.5, 0.5 }; |     double weights[] = { 0.5, 0.5 }; | ||||||
|     return sample_mixture(samplers, weights, 2, seed); |     return sample_mixture(samplers, weights, 2, seed); | ||||||
|  | @ -48,7 +49,6 @@ int main() | ||||||
| 
 | 
 | ||||||
|     int n = 1000 * 1000; |     int n = 1000 * 1000; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     double* mixture_result = malloc(sizeof(double) * n); |     double* mixture_result = malloc(sizeof(double) * n); | ||||||
|     for (int i = 0; i < n; i++) { |     for (int i = 0; i < n; i++) { | ||||||
|         mixture_result[i] = mixture(seed); |         mixture_result[i] = mixture(seed); | ||||||
|  | @ -64,6 +64,5 @@ int main() | ||||||
|     printf("mean: %f\n", array_mean(mixture_result, n)); |     printf("mean: %f\n", array_mean(mixture_result, n)); | ||||||
|     printf("90%% confidence interval: [%f, %f]\n", c_i_90.low, c_i_90.high); |     printf("90%% confidence interval: [%f, %f]\n", c_i_90.low, c_i_90.high); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     free(seed); |     free(seed); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user