/usr/include/nfft3util.h is in libnfft3-dev 3.2.3+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | /*
* Copyright (c) 2002, 2012 Jens Keiner, Stefan Kunis, Daniel Potts
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* $Id: nfft3util.h 3896 2012-10-10 12:19:26Z tovo $ */
/*! \file nfft3util.h
* \brief Header file for utility functions used by the nfft3 library.
*/
#ifndef __UTIL_H__
#define __UTIL_H__
/** Include header for FFTW3 library for its complex type. */
#include <fftw3.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*###########################################################################*/
/*###########################################################################*/
/*###########################################################################*/
/**
* @defgroup nfftutil Util - Auxilliary functions
* @{
*
* This module implements frequently used utility functions.
* In particular, this includes simple measurement of resources, evaluation of
* window functions, vector routines for basic linear algebra tasks, and
* computation of weights for the inverse transforms.
*
*/
/** Swapping of two vectors.
*/
#define NFFT_SWAP_complex(x,y) {fftw_complex* NFFT_SWAP_temp__; \
NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;}
/** Swapping of two vectors.
*/
#define NFFT_SWAP_double(x,y) {double* NFFT_SWAP_temp__; NFFT_SWAP_temp__=(x); \
(x)=(y); (y)=NFFT_SWAP_temp__;}
/** Formerly known to be an irrational number.
*/
#define PI 3.141592653589793238462643383279502884197169399375105820974944592
#define PI2 6.283185307179586476925286766559005768394338798750211641949889185
#define PI4 12.56637061435917295385057353311801153678867759750042328389977837
/** Maximum of its two arguments.
*/
#define NFFT_MAX(a,b) ((a)>(b)? (a) : (b))
/** Mimimum of its two arguments.
*/
#define NFFT_MIN(a,b) ((a)<(b)? (a) : (b))
/* ######################################################################### */
/* ########## Window function related ###################################### */
/* ######################################################################### */
/** To test the new one
*/
double nfft_bspline_old(int k,double x,double *A);
/** Computes the B-spline \f$M_{k,0}\left(x\right)\f$,
scratch is used for de Boor's scheme
*/
double nfft_bspline(int k, double x, double *scratch);
/* ######################################################################### */
/* ########## Vector routines ############################################## */
/* ######################################################################### */
/** Computes integer \f$\prod_{t=0}^{d-1} v_t\f$.
*/
int nfft_prod_int(int *vec, int d);
/** Computes integer \f$\prod_{t=0}^{d-1} v_t-a\f$.
*/
int nfst_prod_minus_a_int(int *vec, int a, int d);
/** Computes \f$\sum_{t=0}^{d-1} i_t \prod_{t'=t+1}^{d-1} N_{t'}\f$.
*/
int nfft_plain_loop(int *idx,int *N,int d);
/** Computes double \f$\prod_{t=0}^{d-1} v_t\f$.
*/
double nfft_prod_real(double *vec,int d);
/** Computes the inner/dot product \f$x^H x\f$.
*/
double nfft_dot_complex(fftw_complex* x, int n);
/** Computes the inner/dot product \f$x^H x\f$.
*/
double nfft_dot_double( double* x, int n);
/** Computes the weighted inner/dot product \f$x^H (w \odot x)\f$.
*/
double nfft_dot_w_complex(fftw_complex* x, double* w, int n);
/** Computes the weighted inner/dot product \f$x^H (w \odot x)\f$.
*/
double nfft_dot_w_double( double* x, double* w, int n);
/** Computes the weighted inner/dot product
\f$x^H (w1\odot w2\odot w2 \odot x)\f$.
*/
double nfft_dot_w_w2_complex(fftw_complex* x, double* w, double* w2, int n);
/** Computes the weighted inner/dot product
\f$x^H (w2\odot w2 \odot x)\f$.
*/
double nfft_dot_w2_complex(fftw_complex* x, double* w2, int n);
/** Copies \f$x \leftarrow y\f$.
*/
void nfft_cp_complex(fftw_complex* x, fftw_complex* y, int n);
/** Copies \f$x \leftarrow y\f$.
*/
void nfft_cp_double( double* x, double* y, int n);
/** Copies \f$x \leftarrow a y\f$.
*/
void nfft_cp_a_complex(fftw_complex* x, double a, fftw_complex* y, int n);
/** Copies \f$x \leftarrow a y\f$.
*/
void nfft_cp_a_double(double *x, double a, double *y, int n);
/** Copies \f$x \leftarrow w\odot y\f$.
*/
void nfft_cp_w_complex(fftw_complex* x, double* w, fftw_complex* y, int n);
/** Copies \f$x \leftarrow w\odot y\f$.
*/
void nfft_cp_w_double( double* x, double* w, double* y, int n);
/** Updates \f$x \leftarrow a x + y\f$.
*/
void nfft_upd_axpy_complex(fftw_complex* x, double a, fftw_complex* y, int n);
/** Updates \f$x \leftarrow a x + y\f$.
*/
void nfft_upd_axpy_double( double* x, double a, double* y, int n);
/** Updates \f$x \leftarrow x + a y\f$.
*/
void nfft_upd_xpay_complex(fftw_complex* x, double a, fftw_complex* y, int n);
/** Updates \f$x \leftarrow x + a y\f$.
*/
void nfft_upd_xpay_double( double* x, double a, double* y, int n);
/** Updates \f$x \leftarrow a x + b y\f$.
*/
void nfft_upd_axpby_complex(fftw_complex* x, double a, fftw_complex* y, double b, int n);
/** Updates \f$x \leftarrow a x + b y\f$.
*/
void nfft_upd_axpby_double( double* x, double a, double* y, double b, int n);
/** Updates \f$x \leftarrow x + a w\odot y\f$.
*/
void nfft_upd_xpawy_complex(fftw_complex* x, double a, double* w, fftw_complex* y, int n);
/** Updates \f$x \leftarrow x + a w\odot y\f$.
*/
void nfft_upd_xpawy_double( double* x, double a, double* w, double* y, int n);
/** Updates \f$x \leftarrow a x + w\odot y\f$.
*/
void nfft_upd_axpwy_complex(fftw_complex* x, double a, double* w, fftw_complex* y, int n);
/** Updates \f$x \leftarrow a x + w\odot y\f$.
*/
void nfft_upd_axpwy_double( double* x, double a, double* w, double* y, int n);
/** Swaps each half over N[d]/2.
*/
void nfft_fftshift_complex(fftw_complex *x, int d, int* N);
/** Prints a vector of integer numbers.
*/
void nfft_vpr_int(int *x, int n, char *text);
/** Prints a vector of doubles numbers.
*/
void nfft_vpr_double(double *x, int n, const char *text);
/** Prints a vector of complex numbers.
*/
void nfft_vpr_complex(fftw_complex *x, int n, const char *text);
/** Inits a vector of random complex numbers in \f$[0,1]\times[0,1]{\rm i}\f$.
*/
void nfft_vrand_unit_complex(fftw_complex *x, int n);
/** Inits a vector of random double numbers in \f$[-1/2,1/2]\f$.
*/
void nfft_vrand_shifted_unit_double(double *x, int n);
/* ######################################################################### */
/* ########## Helpers for inverse transforms ############################### */
/* ######################################################################### */
/** Computes non periodic voronoi weights, assumes ordered nodes \f$x_j\f$ */
void nfft_voronoi_weights_1d(double *w, double *x, int M);
/** Computes voronoi weights for nodes on the sphere S^2. */
void nfft_voronoi_weights_S2(double *w, double *xi, int M);
/** Computes the damping factor for the modified Fejer kernel, ie
\f$\frac{2}{N}\left(1-\frac{\left|2k+1\right|}{N}\right)\f$
*/
double nfft_modified_fejer(int N,int kk);
/** Computes the damping factor for the modified Jackson kernel.
*/
double nfft_modified_jackson2(int N,int kk);
/** Computes the damping factor for the modified generalised Jackson kernel.
*/
double nfft_modified_jackson4(int N,int kk);
/** Computes the damping factor for the modified Sobolev kernel.
*/
double nfft_modified_sobolev(double mu,int kk);
/** Computes the damping factor for the modified multiquadric kernel.
*/
double nfft_modified_multiquadric(double mu,double c,int kk);
int nfft_smbi(const double x, const double alpha, const int nb, const int ize,
double *b);
double nfft_drand48(void);
void nfft_srand48(long int seed);
/** Radix sort for node indices.
*/
void nfft_sort_node_indices_radix_lsdf(int n, int *keys0, int *keys1, int rhigh);
/** Radix sort for node indices.
*/
void nfft_sort_node_indices_radix_msdf(int n, int *keys0, int *keys1, int rhigh);
int nfft_get_num_threads(void);
#ifdef _OPENMP
int nfft_get_omp_num_threads(void);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
/** @}
*/
#endif
|