Skip to content

Instantly share code, notes, and snippets.

@brimonk
Created December 6, 2019 23:45
Show Gist options
  • Save brimonk/23bcb4f96e442bac0552b3f941c80838 to your computer and use it in GitHub Desktop.
Save brimonk/23bcb4f96e442bac0552b3f941c80838 to your computer and use it in GitHub Desktop.
/*
* Brian Chrzanowski
* Fri Dec 06, 2019 18:43
*
* A small test to see if molt_gfquad_m is the problem in the simulation.
*
* Outputs
* 0.500000
* 0.539522
* 0.575920
* 0.609441
* 0.640312
* 0.668743
* 0.694927
* 0.719041
* 0.741250
* 0.761702
* 0.780538
* 0.797885
* 0.813861
* 0.828574
* 0.842125
* 0.854604
* 0.866096
* 0.876681
* 0.886428
* 0.895405
* 0.903673
* 0.911287
* 0.918299
* 0.924757
* 0.930705
* 0.936182
* 0.941226
* 0.945872
* 0.950150
* 0.954091
* 0.957719
* 0.961061
* 0.964139
* 0.966974
* 0.969584
* 0.971988
* 0.974202
* 0.976241
* 0.978119
* 0.979849
* 0.981441
* 0.982908
* 0.984259
* 0.985503
* 0.986649
* 0.987704
* 0.988676
* 0.989570
* 0.990395
* 0.991153
* 0.991852
* 0.992496
* 0.993089
* 0.993635
* 0.994137
* 0.994600
* 0.995027
* 0.995419
* 0.995781
* 0.996113
* 0.996420
* 0.996702
* 0.996962
* 0.997201
* 0.997421
* 0.997624
* 0.997811
* 0.997982
* 0.998140
* 0.998286
* 0.998420
* 0.998543
* 0.998656
* 0.998760
* 0.998856
* 0.998943
* 0.999024
* 0.999098
* 0.999166
* 0.999229
* 0.999286
* 0.999338
* 0.999386
* 0.999429
* 0.999469
* 0.999505
* 0.999538
* 0.999567
* 0.999594
* 0.999618
* 0.999639
* 0.999658
* 0.999675
* 0.999689
* 0.999702
* 0.999712
* 0.999720
* 0.999726
* 0.999731
* 0.999734
* 0.999735
* 0.999734
* 0.999731
* 0.999726
* 0.999720
* 0.999712
* 0.999702
* 0.999689
* 0.999675
* 0.999658
* 0.999639
* 0.999618
* 0.999594
* 0.999567
* 0.999538
* 0.999505
* 0.999469
* 0.999429
* 0.999386
* 0.999338
* 0.999286
* 0.999229
* 0.999166
* 0.999098
* 0.999024
* 0.998943
* 0.998856
* 0.998760
* 0.998656
* 0.998543
* 0.998420
* 0.998286
* 0.998140
* 0.997982
* 0.997811
* 0.997624
* 0.997421
* 0.997201
* 0.996962
* 0.996702
* 0.996420
* 0.996113
* 0.995781
* 0.995419
* 0.995027
* 0.994600
* 0.994137
* 0.993635
* 0.993089
* 0.992496
* 0.991852
* 0.991153
* 0.990395
* 0.989570
* 0.988676
* 0.987704
* 0.986649
* 0.985503
* 0.984259
* 0.982908
* 0.981441
* 0.979849
* 0.978119
* 0.976241
* 0.974202
* 0.971988
* 0.969584
* 0.966974
* 0.964139
* 0.961061
* 0.957719
* 0.954091
* 0.950150
* 0.945872
* 0.941226
* 0.936182
* 0.930705
* 0.924757
* 0.918299
* 0.911287
* 0.903673
* 0.895405
* 0.886428
* 0.876681
* 0.866096
* 0.854604
* 0.842125
* 0.828574
* 0.813861
* 0.797885
* 0.780538
* 0.761702
* 0.741250
* 0.719041
* 0.694927
* 0.668743
* 0.640312
* 0.609441
* 0.575920
* 0.539522
* 0.500000
*/
#include <stdio.h>
#include "src/common.h"
#define MOLT_IMPLEMENTATION
#include "src/molt.h"
#define MOLT_SPACEACC 6
#define MOLT_TIMEACC 3
#if MOLT_TIMEACC == 3
#define MOLT_BETA 1.23429074525305
#elif MOLT_TIMEACC == 2
#define MOLT_BETA 1.48392756860545
#elif MOLT_TIMEACC == 1
#define MOLT_BETA 2
#endif
#define MOLT_ALPHA (8.234301513035760)
#define POINTS (200)
#define PINC (POINTS + 1)
#define ACC (6)
int main(int argc, char **argv)
{
f64 dst[PINC], src[PINC];
f64 *wl, *wr;
f64 nu, dnu;
s32 elems;
s32 i;
elems = POINTS * (ACC + 1);
wl = calloc(elems, sizeof(f64));
wr = calloc(elems, sizeof(f64));
nu = MOLT_ALPHA * 1e-2 * 1;
dnu = exp(-nu);
molt_get_exp_weights(nu, wl, wr, POINTS, ACC);
for (i = 0; i < PINC; i++) {
src[i] = 1.0;
}
molt_gfquad_m(dst, src, dnu, wl, wr, PINC, ACC);
for (i = 0; i < PINC; i++) {
printf("%lf\n", dst[i]);
}
free(wl);
free(wr);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment