gsl_dht.h 2.6 KB

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