| 1 |
/* dht/gsl_dht.h |
| 2 |
* |
| 3 |
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
/* Author: G. Jungman |
| 21 |
*/ |
| 22 |
#ifndef __GSL_DHT_H__ |
| 23 |
#define __GSL_DHT_H__ |
| 24 |
|
| 25 |
#undef __BEGIN_DECLS |
| 26 |
#undef __END_DECLS |
| 27 |
#ifdef __cplusplus |
| 28 |
# define __BEGIN_DECLS extern "C" { |
| 29 |
# define __END_DECLS } |
| 30 |
#else |
| 31 |
# define __BEGIN_DECLS /* empty */ |
| 32 |
# define __END_DECLS /* empty */ |
| 33 |
#endif |
| 34 |
|
| 35 |
__BEGIN_DECLS |
| 36 |
|
| 37 |
|
| 38 |
struct gsl_dht_struct { |
| 39 |
size_t size; /* size of the sample arrays to be transformed */ |
| 40 |
double nu; /* Bessel function order */ |
| 41 |
double xmax; /* the upper limit to the x-sampling domain */ |
| 42 |
double kmax; /* the upper limit to the k-sampling domain */ |
| 43 |
double * j; /* array of computed J_nu zeros, j_{nu,s} = j[s] */ |
| 44 |
double * Jjj; /* transform numerator, J_nu(j_i j_m / j_N) */ |
| 45 |
double * J2; /* transform denominator, J_{nu+1}^2(j_m) */ |
| 46 |
}; |
| 47 |
typedef struct gsl_dht_struct gsl_dht; |
| 48 |
|
| 49 |
|
| 50 |
/* Create a new transform object for a given size |
| 51 |
* sampling array on the domain [0, xmax]. |
| 52 |
*/ |
| 53 |
gsl_dht * gsl_dht_alloc(size_t size); |
| 54 |
gsl_dht * gsl_dht_new(size_t size, double nu, double xmax); |
| 55 |
|
| 56 |
/* Recalculate a transform object for given values of nu, xmax. |
| 57 |
* You cannot change the size of the object since the internal |
| 58 |
* allocation is reused. |
| 59 |
*/ |
| 60 |
int gsl_dht_init(gsl_dht * t, double nu, double xmax); |
| 61 |
|
| 62 |
/* The n'th computed x sample point for a given transform. |
| 63 |
* 0 <= n <= size-1 |
| 64 |
*/ |
| 65 |
double gsl_dht_x_sample(const gsl_dht * t, int n); |
| 66 |
|
| 67 |
|
| 68 |
/* The n'th computed k sample point for a given transform. |
| 69 |
* 0 <= n <= size-1 |
| 70 |
*/ |
| 71 |
double gsl_dht_k_sample(const gsl_dht * t, int n); |
| 72 |
|
| 73 |
|
| 74 |
/* Free a transform object. |
| 75 |
*/ |
| 76 |
void gsl_dht_free(gsl_dht * t); |
| 77 |
|
| 78 |
|
| 79 |
/* Perform a transform on a sampled array. |
| 80 |
* f_in[0] ... f_in[size-1] and similarly for f_out[] |
| 81 |
*/ |
| 82 |
int gsl_dht_apply(const gsl_dht * t, double * f_in, double * f_out); |
| 83 |
|
| 84 |
|
| 85 |
__END_DECLS |
| 86 |
|
| 87 |
#endif /* __GSL_DHT_H__ */ |