AdH Kraken 0.0.0
Next generation Adaptive Hydraulics
Loading...
Searching...
No Matches
sarray.h
1#ifndef H_SARRAY_
2#define H_SARRAY_
3
4/*********************************************************/
5/* struct methods -------------------------------------- */
6
7void sarray_init_int(int *, int);
8void sarray_init_dbl(double *, int);
9
10void sarray_init_value_int(int *, int, int);
11void sarray_init_value_dbl(double *, int, double);
12
13void sarray_init_value_range_int(int *, int, int, int);
14void sarray_init_value_range_dbl(double *, double, int, int);
15
16void sarray_init2one_int(int *, int);
17void sarray_init2one_dbl(double *, int);
18
19void sarray_init_range_int(int *array, int size);
20void sarray_init_arange_int(int *array, int start, int step, int size);
21
22void sarray_copy_int(int *to, int *from, int nsize);
23void sarray_copy_dbl(double *to, double *from, int nsize);
24
25int sarray_sum_int(int *array, int nsize);
26double sarray_sum_dbl(double *array, int nsize);
27
28void sarray_add_replace_int(int *array1, int *array2, int nsize);
29void sarray_add_replace_dbl(double *array1, double *array2, int nsize);
30
31void sarray_add_int(int *result, int *array1, int *array2, int nsize);
32void sarray_add_dbl(double *result, double *array1, double *array2, int nsize);
33
34void sarray_subtract_replace_int(int *array1, int *array2, int nsize);
35void sarray_subtract_replace_dbl(double *array1, double *array2, int nsize);
36
37void sarray_subtract_int(int *result, int *array1, int *array2, int nsize);
38void sarray_subtract_dbl(double *result, double *array1, double *array2, int nsize);
39
40void sarray_add_scalar_int(int *array, int scalar, int nsize);
41void sarray_add_scalar_dbl(double *array, double scalar, int nsize);
42
43void sarray_subtract_scalar_int(int *array, int scalar, int nsize);
44void sarray_subtract_scalar_dbl(double *array, double scalar, int nsize);
45
46double sarray_avg_int(int *array, int nsize);
47double sarray_avg_dbl(double *array, int nsize);
48
49void sarray_scale_int(int *scaled_array, int *array, int scale, int nsize);
50void sarray_scale_dbl(double *scaled_array, double *array, double scale, int nsize);
51
52void sarray_scale_replace_int(int *array, int scale, int nsize);
53void sarray_scale_replace_dbl(double *array, double scale, int nsize);
54
55void sarray_integrity_check_int(int *array, int nsize, int linenumber, char *filename);
56void sarray_integrity_check_dbl(double *array, int nsize, int linenumber, char *filename);
57
58void sarray_printScreen_int(int *array, int nsize, char *name);
59void sarray_printScreen_dbl(double *array, int nsize, char *name);
60
61void sarray_print_int(SGRID *, FILE *, FILE *, int *, int **, int, int *, int);
62void sarray_print_dbl(SGRID *, FILE *, FILE *, double *, int **, int, int *, int);
63
64void sarray_2column_print_int(FILE *fout, int *array1, int *array2, int size);
65void sarray_2column_print_dbl(FILE *fout, double *array1, double *array2, int size);
66
67void sarray_3column_print_int(FILE *fout, int *array1, int *array2, int *array3, int size);
68void sarray_3column_print_dbl(FILE *fout, double *array1, double *array2, double *array3, int size);
69
70void sarray_vector_matrix_multiply(double *v, double **matrix, double *vout, int ndim);
71void sarray_matrix_matrix_multiply(double **matrix1, double **matrix2, double **matrix_out, int ndim1, int ndim2);
72
73int sarray_max_int(int a[], int num_elements);
74double sarray_max_dbl(double a[], int num_elements);
75
76void sarray_init_int_2d(int **to, int nrows, int ncols);
77void sarray_init_double_2d(double **to, int nrows, int ncols);
78
79void sarray_y_plus_ax_dbl(double *y, double alpha, double *x, int n);
80double sarray_dot_dbl(double *x, double *y,int n);
81
82double sarray_l_infty_norm(double *v1, int n);
83int sarray_unique_int(int *arr, int size);
84int sarray_is_in_int(int *arr, int size, int val);
85int sarray_argmin_int(int *arr, int n);
86int sarray_argsort_int(int *my_int_arr, int *my_index_arr, int size);
87int sarray_shuffle_int(int *my_int_arr, int *my_index_arr, int size);
88int sarray_reverse_argsort_int(int *my_int_arr, int *my_index_arr, int size);
89
90int sarray_num_nonzero_int(int *arr, int size);
91int sarray_get_indeces_nonzero_int(int *result, int *arr, int size);
92int sarray_isordered_int(int *arr, int size);
93int sarray_max_distance_int(int *arr, int size);
94
95#endif
Definition: sgrid.h:28