FNFT
fnft__misc.h
Go to the documentation of this file.
1 /*
2 * This file is part of FNFT.
3 *
4 * FNFT is free software; you can redistribute it and/or
5 * modify it under the terms of the version 2 of the GNU General
6 * Public License as published by the Free Software Foundation.
7 *
8 * FNFT is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Contributors:
17 * Sander Wahls (TU Delft) 2017-2018.
18 */
19 
26 #ifndef FNFT__MISC_H
27 #define FNFT__MISC_H
28 
29 #include "fnft.h"
30 
40 void fnft__misc_print_buf(const FNFT_INT len, FNFT_COMPLEX const * const buf,
41  char const * const varname);
42 
55  FNFT_COMPLEX const * const vec_numer, FNFT_COMPLEX const * const vec_exact);
56 
69  FNFT_COMPLEX const * const vecA, const FNFT_UINT lenB,
70  FNFT_COMPLEX const * const vecB);
71 
81 
94 FNFT_REAL fnft__misc_l2norm2(const FNFT_UINT N, FNFT_COMPLEX const * const Z,
95  const FNFT_REAL a, const FNFT_REAL b);
96 
120 FNFT_INT fnft__misc_filter(FNFT_UINT * const N, FNFT_COMPLEX * const vals,
121  FNFT_COMPLEX * const rearrange_as_well,
122  FNFT_REAL const * const bounding_box);
123 
124 
138  const FNFT_REAL tol_im);
139 
156 FNFT_INT fnft__misc_filter_inv(FNFT_UINT * const N_ptr, FNFT_COMPLEX * const vals,
157  FNFT_COMPLEX * const rearrange_as_well,
158  FNFT_REAL const * const bounding_box);
159 
172 FNFT_INT fnft__misc_merge(FNFT_UINT *N_ptr, FNFT_COMPLEX * const vals,
173  FNFT_REAL tol);
174 
196 FNFT_INT fnft__misc_downsample(const FNFT_UINT D, FNFT_COMPLEX const * const q,
197  FNFT_UINT * const Dsub_ptr, FNFT_COMPLEX ** qsub_ptr,
198  FNFT_UINT * const first_last_index);
199 
209 
218 
219 #ifdef FNFT_ENABLE_SHORT_NAMES
220 #define misc_print_buf(...) fnft__misc_print_buf(__VA_ARGS__)
221 #define misc_rel_err(...) fnft__misc_rel_err(__VA_ARGS__)
222 #define misc_hausdorff_dist(...) fnft__misc_hausdorff_dist(__VA_ARGS__)
223 #define misc_sech(...) fnft__misc_sech(__VA_ARGS__)
224 #define misc_l2norm2(...) fnft__misc_l2norm2(__VA_ARGS__)
225 #define misc_filter(...) fnft__misc_filter(__VA_ARGS__)
226 #define misc_filter_inv(...) fnft__misc_filter_inv(__VA_ARGS__)
227 #define misc_filter_nonreal(...) fnft__misc_filter_nonreal(__VA_ARGS__)
228 #define misc_merge(...) fnft__misc_merge(__VA_ARGS__)
229 #define misc_downsample(...) fnft__misc_downsample(__VA_ARGS__)
230 #define misc_CSINC(...) fnft__misc_CSINC(__VA_ARGS__)
231 #define misc_nextpowerof2(...) fnft__misc_nextpowerof2(__VA_ARGS__)
232 #endif
233 
234 #endif
FNFT_INT
int32_t FNFT_INT
Definition: fnft_numtypes.h:56
FNFT_UINT
size_t FNFT_UINT
Definition: fnft_numtypes.h:62
fnft__misc_rel_err
FNFT_REAL fnft__misc_rel_err(const FNFT_INT len, FNFT_COMPLEX const *const vec_numer, FNFT_COMPLEX const *const vec_exact)
Relative l1 error between two vectors.
fnft__misc_nextpowerof2
FNFT_UINT fnft__misc_nextpowerof2(const FNFT_UINT number)
Closest larger or equal number that is a power of two.
fnft__misc_downsample
FNFT_INT fnft__misc_downsample(const FNFT_UINT D, FNFT_COMPLEX const *const q, FNFT_UINT *const Dsub_ptr, FNFT_COMPLEX **qsub_ptr, FNFT_UINT *const first_last_index)
Downsamples an array.
fnft__misc_sech
FNFT_COMPLEX fnft__misc_sech(FNFT_COMPLEX Z)
Hyperbolic secant.
fnft__misc_hausdorff_dist
FNFT_REAL fnft__misc_hausdorff_dist(const FNFT_UINT lenA, FNFT_COMPLEX const *const vecA, const FNFT_UINT lenB, FNFT_COMPLEX const *const vecB)
Hausdorff distance between two vectors.
fnft__misc_l2norm2
FNFT_REAL fnft__misc_l2norm2(const FNFT_UINT N, FNFT_COMPLEX const *const Z, const FNFT_REAL a, const FNFT_REAL b)
Squared l2 norm.
fnft__misc_filter_nonreal
FNFT_INT fnft__misc_filter_nonreal(FNFT_UINT *N_ptr, FNFT_COMPLEX *const vals, const FNFT_REAL tol_im)
Filter array based on specified tolerance.
FNFT_COMPLEX
double complex FNFT_COMPLEX
Definition: fnft_numtypes.h:47
fnft__misc_merge
FNFT_INT fnft__misc_merge(FNFT_UINT *N_ptr, FNFT_COMPLEX *const vals, FNFT_REAL tol)
Merges elements in an array with distance lower than tol.
FNFT_REAL
double FNFT_REAL
Definition: fnft_numtypes.h:40
fnft__misc_filter
FNFT_INT fnft__misc_filter(FNFT_UINT *const N, FNFT_COMPLEX *const vals, FNFT_COMPLEX *const rearrange_as_well, FNFT_REAL const *const bounding_box)
Filters array by retaining elements inside a bounding box.
fnft__misc_print_buf
void fnft__misc_print_buf(const FNFT_INT len, FNFT_COMPLEX const *const buf, char const *const varname)
Helper function for debugging. Prints an array in MATLAB style.
fnft__misc_filter_inv
FNFT_INT fnft__misc_filter_inv(FNFT_UINT *const N_ptr, FNFT_COMPLEX *const vals, FNFT_COMPLEX *const rearrange_as_well, FNFT_REAL const *const bounding_box)
Filters array by retaining elements outside a bounding box.
fnft__misc_CSINC
FNFT_COMPLEX fnft__misc_CSINC(FNFT_COMPLEX x)
Sinc function for complex arguments.