CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
arrays.h
1
5#ifndef __ARRAYS__
6#define __ARRAYS__
7
8#include <vector>
9
10#include "common.h"
11
12#ifdef _WIN32
13#define _restrict
14#endif
15
16#define _SPLINE_NATURAL_ 0
17#define _SPLINE_EST_DERIV_ 1
19void array_derive_spline(const double* x_array,
20 int n_lines,
21 double* array,
22 const double* array_splined,
23 int n_columns,
24 int index_y,
25 int index_dydx);
26
27void array_derive_spline_table_line_to_line(const double* x_array,
28 int n_lines,
29 double* array,
30 int n_columns,
31 int index_y,
32 int index_ddy,
33 int index_dy);
34
35void array_spline(double* array,
36 int n_columns,
37 int n_lines,
38 int index_x,
39 int index_y,
40 int index_ddydx2,
41 short spline_mode);
42
43void array_spline_table_line_to_line(const double* x, /* vector of size n_lines */
44 int n_lines,
45 double* array,
46 int n_columns,
47 int index_y,
48 int index_ddydx2,
49 short spline_mode);
50
51/* Cubic-spline second derivatives. Each wrapper splines every curve of a table in its own
52 layout: `columns` takes y_array[index_y * x_size + index_x], `lines` takes
53 y_array[index_x * y_size + index_y], and the other two a column of a line-major array.
54 With two points the spline is natural whatever spline_mode says. */
55void array_spline_table_columns(const double* x,
56 int x_size,
57 const double* y_array,
58 int y_size,
59 double* ddy_array,
60 short spline_mode);
61
62void array_spline_table_lines(const double* x,
63 int x_size,
64 const double* y_array,
65 int y_size,
66 double* ddy_array,
67 short spline_mode);
68
69void array_integrate_all_spline(const double* array,
70 int n_columns,
71 int n_lines,
72 int index_x,
73 int index_y,
74 int index_ddy,
75 double* result);
76
77void array_integrate_all_trapzd_or_spline(const double* array,
78 int n_columns,
79 int n_lines,
80 int index_start_spline,
81 int index_x,
82 int index_y,
83 int index_ddy,
84 double* result);
85
93void array_spline_integration_weights(
94 const double* x, int n_lines, int index_start_spline, short spline_mode, double* w);
95
96void array_integrate_spline_table_line_to_line(const double* x_array,
97 int n_lines,
98 double* array,
99 int n_columns,
100 int index_y,
101 int index_ddy,
102 int index_inty);
103
104void array_interpolate_spline(const double* x_array,
105 int n_lines,
106 const double* array,
107 const double* array_splined,
108 int n_columns,
109 double x,
110 int* last_index,
111 double* result,
112 int result_size);
114void array_search_bisect(int n_lines, const double* array, double c, int* last_index);
115
116void array_interpolate_linear(const double* x_array,
117 int n_lines,
118 const double* array,
119 int n_columns,
120 double x,
121 int* last_index,
122 double* result,
123 int result_size);
125void array_interpolate_one_growing_closeby(const double* array,
126 int n_columns,
127 int n_lines,
128 int index_x,
129 double x,
130 int* last_index,
131 int index_y,
132 double* result);
133
134void array_interpolate_spline_growing_closeby(const double* x_array,
135 int n_lines,
136 const double* array,
137 const double* array_splined,
138 int n_columns,
139 double x,
140 int* last_index,
141 double* result,
142 int result_size);
144void array_interpolate_two(const double* array_x,
145 int n_columns_x,
146 int index_x,
147 const double* array_y,
148 int n_lines,
149 double x,
150 double* result,
151 int result_size);
152
153void array_interpolate_two_bis(const double* array_x,
154 int n_columns_x,
155 int index_x,
156 const double* array_y,
157 int n_columns_y,
158 int n_lines,
159 double x,
160 double* result,
161 int result_size);
163void array_interpolate_two_arrays_one_column(
164 const double* array_x, /* assumed to be a vector (i.e. one column array) */
165 const double* array_y,
166 int index_y,
167 int n_lines,
168 double x,
169 double* result);
170
171void array_interpolate_parabola(double x1,
172 double x2,
173 double x3,
174 double x,
175 double y1,
176 double y2,
177 double y3,
178 double* y,
179 double* dy,
180 double* ddy);
181
182void array_smooth(double* array,
183 int n_columns,
184 int n_lines,
185 int index,
186 int radius);
187
188void array_trapezoidal_mweights(const double* x, int n, double* w_trapz);
189
190void array_trapezoidal_integral(const double* integrand, int n, const double* w_trapz, double* I);
191
192void array_trapezoidal_convolution(
193 const double* integrand1, const double* integrand2, int n, const double* w_trapz, double* I);
194
195#endif