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 #include <stdlib.h>
26 
27 #undef __BEGIN_DECLS
28 #undef __END_DECLS
29 #ifdef __cplusplus
30 # define __BEGIN_DECLS extern "C" {
31 # define __END_DECLS }
32 #else
33 # define __BEGIN_DECLS /* empty */
34 # define __END_DECLS /* empty */
35 #endif
36 
37 __BEGIN_DECLS
38 
39 
40 struct gsl_dht_struct {
41   size_t    size;  /* size of the sample arrays to be transformed    */
42   double    nu;    /* Bessel function order                          */
43   double    xmax;  /* the upper limit to the x-sampling domain       */
44   double    kmax;  /* the upper limit to the k-sampling domain       */
45   double *  j;     /* array of computed J_nu zeros, j_{nu,s} = j[s]  */
46   double *  Jjj;   /* transform numerator, J_nu(j_i j_m / j_N)       */
47   double *  J2;    /* transform denominator, J_{nu+1}^2(j_m)         */
48 };
49 typedef struct gsl_dht_struct gsl_dht;
50 
51 
52 /* Create a new transform object for a given size
53  * sampling array on the domain [0, xmax].
54  */
55 gsl_dht * gsl_dht_alloc(size_t size);
56 gsl_dht * gsl_dht_new(size_t size, double nu, double xmax);
57 
58 /* Recalculate a transform object for given values of nu, xmax.
59  * You cannot change the size of the object since the internal
60  * allocation is reused.
61  */
62 int gsl_dht_init(gsl_dht * t, double nu, double xmax);
63 
64 /* The n'th computed x sample point for a given transform.
65  * 0 <= n <= size-1
66  */
67 double gsl_dht_x_sample(const gsl_dht * t, int n);
68 
69 
70 /* The n'th computed k sample point for a given transform.
71  * 0 <= n <= size-1
72  */
73 double gsl_dht_k_sample(const gsl_dht * t, int n);
74 
75 
76 /* Free a transform object.
77  */
78 void gsl_dht_free(gsl_dht * t);
79 
80 
81 /* Perform a transform on a sampled array.
82  * f_in[0] ... f_in[size-1] and similarly for f_out[]
83  */
84 int gsl_dht_apply(const gsl_dht * t, double * f_in, double * f_out);
85 
86 
87 __END_DECLS
88 
89 #endif /* __GSL_DHT_H__ */
90