-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoto_tools.h
78 lines (51 loc) · 1.42 KB
/
goto_tools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "containers.h"
#ifndef GOTO_H
#define GOTO_H
#define pi 3.141592654
#define chisq_exception 1.0e30
void kill(char*);
double raiseup(double,double);
double power(double,int);
struct Ran{
//this structure will be based on the Xorshift random number generator
// discovered by George Marsaglia and published in
//Journal of Statistical Software, volume 8, no. 14 pp 1-6
//parameters are drawn from the table on page 347 of
//Numerical Recipes (3rd edition)
//William H. press, Saul A. Teukolsky, William T. Vetterling, Brian P. Flannery
//Cambridge University Press, 2007
unsigned long long x;
Ran(unsigned long long seed){
x=seed^88172645463325252LL;
x^=(x<<21);
x^=(x>>35);
x^=(x<<4);
//printf("starting rand with %ld from seed %d\n",x,seed);
}
void thework(){
x^=(x<<21);
x^=(x>>35);
x^=(x<<4);
}
double doub(){
thework();
return x*5.42101086242752217e-20;
}
int int32(){
thework();
int ans=int(x);
if(ans<0)ans=-1*ans;
return ans;
}
};
void polint(double*,double*,int,double,double*,double*);
double interpolate(double*,double*,double,int);
void sort(double*,int*,int);
void check_sort(double*,int*,int);
void sort_and_check(double*,double*,int*,int);
double normal_deviate(Ran*,double,double);
void naive_gaussian_solver(array_1d<double>&,array_1d<double>&,
array_1d<double>&,int);
double compare_arr(array_1d<double>&,array_1d<double>&);
int compare_int_arr(array_1d<int>&, array_1d<int>&);
#endif