fix: reorder headers to fix compilation error
This commit is contained in:
parent
61851a321a
commit
6387c0df70
|
@ -1,7 +1,7 @@
|
|||
#include "../../squiggle.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Estimate functions
|
||||
double sample_0(uint64_t* seed)
|
||||
|
@ -24,7 +24,8 @@ double sample_many(uint64_t* seed)
|
|||
return sample_to(2, 10, seed);
|
||||
}
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
// set randomness seed
|
||||
uint64_t* seed = malloc(sizeof(uint64_t));
|
||||
*seed = 1000; // xorshift can't start with 0
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "../../squiggle.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
// set randomness seed
|
||||
uint64_t* seed = malloc(sizeof(uint64_t));
|
||||
*seed = 1000; // xorshift can't start with 0
|
||||
|
@ -35,4 +36,3 @@ int main(){
|
|||
printf("]\n");
|
||||
free(seed);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -42,4 +42,3 @@ int main()
|
|||
|
||||
free(seed);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -5,7 +5,8 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
// Estimate functions
|
||||
double beta_1_2_sampler(uint64_t* seed){
|
||||
double beta_1_2_sampler(uint64_t* seed)
|
||||
{
|
||||
return sample_beta(1, 2.0, seed);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -45,7 +45,5 @@ int main()
|
|||
ci ci_90 = get_90_confidence_interval(sample_minutes_per_day_jumping_rope_needed_to_burn_10kg, seed);
|
||||
printf("90%% confidence interval: [%f, %f]\n", ci_90.low, ci_90.high);
|
||||
|
||||
|
||||
|
||||
free(seed);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -14,17 +14,20 @@ double yearly_probability_nuclear_collapse(double year, uint64_t* seed)
|
|||
// to get a probability,
|
||||
// rather than sampling from a distribution over probabilities.
|
||||
}
|
||||
double yearly_probability_nuclear_collapse_2023(uint64_t* seed){
|
||||
double yearly_probability_nuclear_collapse_2023(uint64_t* seed)
|
||||
{
|
||||
return yearly_probability_nuclear_collapse(2023, seed);
|
||||
}
|
||||
|
||||
double yearly_probability_nuclear_collapse_after_recovery(double year, double rebuilding_period_length_years, uint64_t* seed){
|
||||
double yearly_probability_nuclear_collapse_after_recovery(double year, double rebuilding_period_length_years, uint64_t* seed)
|
||||
{
|
||||
// assumption: nuclear
|
||||
double successes = 1.0;
|
||||
double failures = (year - rebuilding_period_length_years - 1960 - 1);
|
||||
return sample_laplace(successes, failures, seed);
|
||||
}
|
||||
double yearly_probability_nuclear_collapse_after_recovery_example(uint64_t* seed){
|
||||
double yearly_probability_nuclear_collapse_after_recovery_example(uint64_t* seed)
|
||||
{
|
||||
double year = 2070;
|
||||
double rebuilding_period_length_years = 30;
|
||||
// So, there was a nuclear collapse in 2040,
|
||||
|
@ -33,7 +36,8 @@ double yearly_probability_nuclear_collapse_after_recovery_example(uint64_t* seed
|
|||
return yearly_probability_nuclear_collapse_after_recovery(year, rebuilding_period_length_years, seed);
|
||||
}
|
||||
|
||||
double yearly_probability_nuclear_collapse_after_recovery_antiinductive(uint64_t* seed){
|
||||
double yearly_probability_nuclear_collapse_after_recovery_antiinductive(uint64_t* seed)
|
||||
{
|
||||
return yearly_probability_nuclear_collapse(2023, seed) / 2;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,19 +4,23 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
double sample_0(uint64_t* seed){
|
||||
double sample_0(uint64_t* seed)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double sample_1(uint64_t* seed){
|
||||
double sample_1(uint64_t* seed)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
double sample_normal_mean_1_std_2(uint64_t* seed){
|
||||
double sample_normal_mean_1_std_2(uint64_t* seed)
|
||||
{
|
||||
return sample_normal(1, 2, seed);
|
||||
}
|
||||
|
||||
double sample_1_to_3(uint64_t* seed){
|
||||
double sample_1_to_3(uint64_t* seed)
|
||||
{
|
||||
return sample_to(1, 3, seed);
|
||||
}
|
||||
|
||||
|
|
3
examples/15_plotting-scratchpad/makefile
Normal file
3
examples/15_plotting-scratchpad/makefile
Normal file
|
@ -0,0 +1,3 @@
|
|||
build:
|
||||
|
||||
format:
|
|
@ -1,10 +1,11 @@
|
|||
#include "../../squiggle.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Estimate functions
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
// set randomness seed
|
||||
uint64_t* seed = malloc(sizeof(uint64_t));
|
||||
*seed = 1000; // xorshift can't start with 0
|
||||
|
|
3
extra.c
3
extra.c
|
@ -1,3 +1,4 @@
|
|||
#include "squiggle.h"
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
@ -6,7 +7,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include "squiggle.h"
|
||||
|
||||
// math constants
|
||||
#define PI 3.14159265358979323846 // M_PI in gcc gnu99
|
||||
|
@ -58,7 +58,6 @@ ci get_90_confidence_interval(double (*sampler)(uint64_t*), uint64_t* seed)
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
// ## Sample from an arbitrary cdf
|
||||
struct box {
|
||||
int empty;
|
||||
|
|
Loading…
Reference in New Issue
Block a user