SAF
Loading...
Searching...
No Matches
saf_utility_sort.h
Go to the documentation of this file.
1/*
2 * Copyright 2016-2018 Leo McCormack
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
15 */
16
28#ifndef SAF_SORT_H_INCLUDED
29#define SAF_SORT_H_INCLUDED
30
31#ifdef __cplusplus
32extern "C" {
33#endif /* __cplusplus */
34
35/* ========================================================================== */
36/* Main Functions */
37/* ========================================================================== */
38
50void sorti(int* in_vec,
51 int* out_vec,
52 int* new_indices,
53 int len,
54 int descendFLAG);
55
69void sortf(float* in_vec,
70 float* out_vec,
71 int* new_indices,
72 int len,
73 int descendFLAG);
74
86void sortd(double* in_vec,
87 double* out_vec,
88 int* new_indices,
89 int len,
90 int descendFLAG);
91
103void sortc(float_complex* in_vec,
104 float_complex* out_vec,
105 int len,
106 int descendFLAG);
107
122void sortz(double_complex* in_vec,
123 double_complex* out_vec,
124 int len,
125 int descendFLAG);
126
141void cmplxPairUp(double_complex* in_vec,
142 double_complex* out_vec,
143 int len);
144
166void findClosestGridPoints(float* grid_dirs,
167 int nGrid,
168 float* target_dirs,
169 int nTarget,
170 int degFLAG,
171 int* idx_closest,
172 float* dirs_closest,
173 float* angle_diff);
174
186void findClosestGridPointsCartesian(float* grid_dirs_xyz,
187 int nGrid,
188 float* target_dirs_xyz,
189 int nTarget,
190 int* idx_closest,
191 float* dirs_xyz_closest,
192 float* angle_diff);
193
194
195#ifdef __cplusplus
196}/* extern "C" */
197#endif /* __cplusplus */
198
199#endif /* SAF_SORT_H_INCLUDED */
200
201 /* doxygen addtogroup Utilities */
void sortf(float *in_vec, float *out_vec, int *new_indices, int len, int descendFLAG)
Sort a vector of floating-point values into ascending/decending order (optionally returning the new i...
void cmplxPairUp(double_complex *in_vec, double_complex *out_vec, int len)
Pairs up complex numbers and sorts them in ascending order based on their real parts first,...
void sortd(double *in_vec, double *out_vec, int *new_indices, int len, int descendFLAG)
Sort a vector of double floating-point values into ascending/decending order (optionally returning th...
void sortc(float_complex *in_vec, float_complex *out_vec, int len, int descendFLAG)
Sort a vector of complex floating-point values into ascending/decending order.
void sortz(double_complex *in_vec, double_complex *out_vec, int len, int descendFLAG)
Sort a vector of complex double floating-point values into ascending/ decending order.
void sorti(int *in_vec, int *out_vec, int *new_indices, int len, int descendFLAG)
Sort a vector of integer values into ascending/decending order (optionally returning the new indices ...
void findClosestGridPointsCartesian(float *grid_dirs_xyz, int nGrid, float *target_dirs_xyz, int nTarget, int *idx_closest, float *dirs_xyz_closest, float *angle_diff)
Finds indicies into "grid_dirs_xyz" that are the closest to "target dirs_xyz".
void findClosestGridPoints(float *grid_dirs, int nGrid, float *target_dirs, int nTarget, int degFLAG, int *idx_closest, float *dirs_closest, float *angle_diff)
Finds indicies into "grid_dirs" that are the closest to "target dirs".