forked from personal/squiggle.c
scratchpad formatting pass
This commit is contained in:
parent
487de4a731
commit
65756a359b
|
@ -240,7 +240,6 @@ struct box inverse_cdf_float(float cdf(float), float p)
|
||||||
} else {
|
} else {
|
||||||
PROCESS_ERROR("Search process did not converge, in function inverse_cdf");
|
PROCESS_ERROR("Search process did not converge, in function inverse_cdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +316,6 @@ struct box inverse_cdf_box(struct box cdf_box(float), float p)
|
||||||
} else {
|
} else {
|
||||||
PROCESS_ERROR("Search process did not converge, in function inverse_cdf");
|
PROCESS_ERROR("Search process did not converge, in function inverse_cdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +369,8 @@ float sampler_normal_0_1(uint32_t* seed)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some testers
|
// Some testers
|
||||||
void test_inverse_cdf_float(char* cdf_name, float cdf_float(float)){
|
void test_inverse_cdf_float(char* cdf_name, float cdf_float(float))
|
||||||
|
{
|
||||||
struct box result = inverse_cdf_float(cdf_float, 0.5);
|
struct box result = inverse_cdf_float(cdf_float, 0.5);
|
||||||
if (result.empty) {
|
if (result.empty) {
|
||||||
printf("Inverse for %s not calculated\n", cdf_name);
|
printf("Inverse for %s not calculated\n", cdf_name);
|
||||||
|
@ -379,9 +378,9 @@ void test_inverse_cdf_float(char* cdf_name, float cdf_float(float)){
|
||||||
} else {
|
} else {
|
||||||
printf("Inverse of %s at %f is: %f\n", cdf_name, 0.5, result.content);
|
printf("Inverse of %s at %f is: %f\n", cdf_name, 0.5, result.content);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void test_inverse_cdf_box(char* cdf_name, struct box cdf_box(float)){
|
void test_inverse_cdf_box(char* cdf_name, struct box cdf_box(float))
|
||||||
|
{
|
||||||
struct box result = inverse_cdf_box(cdf_box, 0.5);
|
struct box result = inverse_cdf_box(cdf_box, 0.5);
|
||||||
if (result.empty) {
|
if (result.empty) {
|
||||||
printf("Inverse for %s not calculated\n", cdf_name);
|
printf("Inverse for %s not calculated\n", cdf_name);
|
||||||
|
@ -389,10 +388,10 @@ void test_inverse_cdf_box(char* cdf_name, struct box cdf_box(float)){
|
||||||
} else {
|
} else {
|
||||||
printf("Inverse of %s at %f is: %f\n", cdf_name, 0.5, result.content);
|
printf("Inverse of %s at %f is: %f\n", cdf_name, 0.5, result.content);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_and_time_sampler_float(char* cdf_name, float cdf_float(float), uint32_t* seed){
|
void test_and_time_sampler_float(char* cdf_name, float cdf_float(float), uint32_t* seed)
|
||||||
|
{
|
||||||
printf("\nGetting some samples from %s:\n", cdf_name);
|
printf("\nGetting some samples from %s:\n", cdf_name);
|
||||||
clock_t begin = clock();
|
clock_t begin = clock();
|
||||||
for (int i = 0; i < NUM_SAMPLES; i++) {
|
for (int i = 0; i < NUM_SAMPLES; i++) {
|
||||||
|
@ -408,7 +407,8 @@ void test_and_time_sampler_float(char* cdf_name, float cdf_float(float), uint32_
|
||||||
printf("Time spent: %f\n", time_spent);
|
printf("Time spent: %f\n", time_spent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_and_time_sampler_box(char* cdf_name, struct box cdf_box(float), uint32_t* seed){
|
void test_and_time_sampler_box(char* cdf_name, struct box cdf_box(float), uint32_t* seed)
|
||||||
|
{
|
||||||
printf("\nGetting some samples from %s:\n", cdf_name);
|
printf("\nGetting some samples from %s:\n", cdf_name);
|
||||||
clock_t begin = clock();
|
clock_t begin = clock();
|
||||||
for (int i = 0; i < NUM_SAMPLES; i++) {
|
for (int i = 0; i < NUM_SAMPLES; i++) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user