13 double t = ((double) RAND_MAX)/2.0;
27 const double two_pi = 2.0 * 3.1415926535;
29 for(i = 0; i < n; i++) {
39 double U1 = rand() * (1.0 / RAND_MAX);
40 double U2 = rand() * (1.0 / RAND_MAX);
42 Z0 = sqrt(-2.0 * log(U1)) * cos(two_pi * U2);
43 Z1 = sqrt(-2.0 * log(U1)) * sin(two_pi * U2);
48 void vecset(
int n,
double t,
double *v) {
54 void linspace(
double a,
double b,
int num,
double *arr){
56 h = (num==1? 0: (b-a)/(num-1));
61 for (i=1; i<num-1; i++)
67 double *aa = (
double*) a;
68 double *bb = (
double*) b;
71 }
else if (*aa == *bb) {
86 }
else if (aa->
d == bb->
d) {
95 qsort(v, n,
sizeof(
double),
compare1);
101 for (i=0; i<n; i++) {
106 for (i=0; i<n; i++) {
114 void vec_perm(
int n,
int *p,
double *x,
double *y) {
116 memcpy(y, x, n*
sizeof(
double));
119 for (i=0; i<n; i++) {
129 memcpy(y, x, n*
sizeof(
double));
132 for (i=0; i<n; i++) {
struct _doubleint doubleint
void vecset(int n, double t, double *v)
void rand_double(int n, double *v)
void vec_iperm(int n, int *p, double *x, double *y)
void vec_perm(int n, int *p, double *x, double *y)
void sort_double(int n, double *v, int *ind)
int compare1(const void *a, const void *b)
This file contains function prototypes and constant definitions internally used in EVSL...
#define Malloc(base, nmem, type)
void randn_double(int n, double *v)
int compare2(const void *a, const void *b)
void linspace(double a, double b, int num, double *arr)