gsl_spline.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* interpolation/gsl_spline.h
  2. *
  3. * Copyright (C) 2001, 2007 Brian Gough
  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. #ifndef __GSL_SPLINE_H__
  20. #define __GSL_SPLINE_H__
  21. #include <stdlib.h>
  22. #include "gsl_interp.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. /* general interpolation object */
  34. typedef struct {
  35. gsl_interp * interp;
  36. double * x;
  37. double * y;
  38. size_t size;
  39. } gsl_spline;
  40. gsl_spline *
  41. gsl_spline_alloc(const gsl_interp_type * T, size_t size);
  42. int
  43. gsl_spline_init(gsl_spline * spline, const double xa[], const double ya[], size_t size);
  44. const char * gsl_spline_name(const gsl_spline * spline);
  45. unsigned int gsl_spline_min_size(const gsl_spline * spline);
  46. int
  47. gsl_spline_eval_e(const gsl_spline * spline, double x,
  48. gsl_interp_accel * a, double * y);
  49. double
  50. gsl_spline_eval(const gsl_spline * spline, double x, gsl_interp_accel * a);
  51. int
  52. gsl_spline_eval_deriv_e(const gsl_spline * spline,
  53. double x,
  54. gsl_interp_accel * a,
  55. double * y);
  56. double
  57. gsl_spline_eval_deriv(const gsl_spline * spline,
  58. double x,
  59. gsl_interp_accel * a);
  60. int
  61. gsl_spline_eval_deriv2_e(const gsl_spline * spline,
  62. double x,
  63. gsl_interp_accel * a,
  64. double * y);
  65. double
  66. gsl_spline_eval_deriv2(const gsl_spline * spline,
  67. double x,
  68. gsl_interp_accel * a);
  69. int
  70. gsl_spline_eval_integ_e(const gsl_spline * spline,
  71. double a, double b,
  72. gsl_interp_accel * acc,
  73. double * y);
  74. double
  75. gsl_spline_eval_integ(const gsl_spline * spline,
  76. double a, double b,
  77. gsl_interp_accel * acc);
  78. void
  79. gsl_spline_free(gsl_spline * spline);
  80. __END_DECLS
  81. #endif /* __GSL_INTERP_H__ */