1 /* bspline/gsl_bspline.h
3 * Copyright (C) 2006 Patrick Alken
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.
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.
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.
20 #ifndef __GSL_BSPLINE_H__
21 #define __GSL_BSPLINE_H__
24 #include <gsl/gsl_math.h>
25 #include <gsl/gsl_vector.h>
30 # define __BEGIN_DECLS extern "C" {
31 # define __END_DECLS }
33 # define __BEGIN_DECLS /* empty */
34 # define __END_DECLS /* empty */
41 size_t k; /* spline order */
42 size_t km1; /* k - 1 (polynomial order) */
43 size_t l; /* number of polynomial pieces on interval */
44 size_t nbreak; /* number of breakpoints (l + 1) */
45 size_t n; /* number of bspline basis functions (l + k - 1) */
47 gsl_vector *knots; /* knots vector */
48 gsl_vector *deltal; /* left delta */
49 gsl_vector *deltar; /* right delta */
50 gsl_vector *B; /* temporary spline results */
51 } gsl_bspline_workspace;
53 gsl_bspline_workspace *
54 gsl_bspline_alloc(const size_t k, const size_t nbreak);
56 void gsl_bspline_free(gsl_bspline_workspace *w);
58 size_t gsl_bspline_ncoeffs (gsl_bspline_workspace * w);
59 size_t gsl_bspline_order (gsl_bspline_workspace * w);
60 size_t gsl_bspline_nbreak (gsl_bspline_workspace * w);
61 double gsl_bspline_breakpoint (size_t i, gsl_bspline_workspace * w);
64 gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w);
66 int gsl_bspline_knots_uniform(const double a, const double b,
67 gsl_bspline_workspace *w);
70 gsl_bspline_eval(const double x, gsl_vector *B,
71 gsl_bspline_workspace *w);
75 #endif /* __GSL_BSPLINE_H__ */