19double _statistics[10];
23 return rand()/(double) RAND_MAX;
35 if (n <= 0)
return NULL;
37 for (i = 0; i < n; i++) p[i] = i;
54 for (i = 0; i < n; i++) y[i] = x[i] - y[i];
60 for (i = 0; i < n; i++) res += x[i]*y[i];
67 for (i = 0; i < n; i++) y[i] = x[i] + beta*y[i];
74 for (i = 0; i < n; i++) x[i] = x[i] + beta*y[i];
82 if (!*u) *u =
gv_calloc(m,
sizeof(
float));
84 for (i = 0; i < m; i++) {
85 assert(p[i] < n && p[i] >= 0);
92 const double *ss1 =
s1;
93 const double *ss2 = s2;
97 }
else if (ss1[0] < ss2[0]){
107 if (ss1[0] > ss2[0]){
109 }
else if (ss1[0] < ss2[0]){
123 double *u =
gv_calloc(2 * n,
sizeof(
double));
125 for (i = 0; i < n; i++) {
132 for (i = 0; i < n; i++) (*p)[i] = (int) u[2*i+1];
157 for (i = 0; i <
dim; i++)
dist += (p1[i] - p2[i])*(p1[i] - p2[i]);
164 for (
size_t i = strlen(
s); ; i--) {
165 if (first &&
s[i] ==
'.') {
169 if (
s[i] ==
'/')
return &
s[i+1];
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
static double dist(int dim, double *x, double *y)
int * random_permutation(int n)
double * vector_saxpy(int n, double *x, double *y, double beta)
double * vector_saxpy2(int n, double *x, double *y, double beta)
char * strip_dir(char *s)
void vector_ordering(int n, double *v, int **p)
double distance(double *x, int dim, int i, int j)
double vector_product(int n, double *x, double *y)
static int comp_ascend_int(const void *s1, const void *s2)
void vector_float_take(int n, float *v, int m, int *p, float **u)
void vector_sort_int(int n, int *v)
double * vector_subtract_to(int n, double *x, double *y)
double distance_cropped(double *x, int dim, int i, int j)
double point_distance(double *p1, double *p2, int dim)
static int comp_ascend(const void *s1, const void *s2)
static double len(glCompPoint p)
NEATOPROCS_API void s1(graph_t *, node_t *)