File: BSpline.pm.1.16

package info (click to toggle)
libmath-gsl-perl 0.45-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192,156 kB
  • sloc: ansic: 895,524; perl: 24,682; makefile: 12
file content (352 lines) | stat: -rw-r--r-- 11,216 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.2.0
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.

package Math::GSL::BSpline;
use base qw(Exporter);
use base qw(DynaLoader);
package Math::GSL::BSplinec;
bootstrap Math::GSL::BSpline;
package Math::GSL::BSpline;
@EXPORT = qw();

# ---------- BASE METHODS -------------

package Math::GSL::BSpline;

sub TIEHASH {
    my ($classname,$obj) = @_;
    return bless $obj, $classname;
}

sub CLEAR { }

sub FIRSTKEY { }

sub NEXTKEY { }

sub FETCH {
    my ($self,$field) = @_;
    my $member_func = "swig_${field}_get";
    $self->$member_func();
}

sub STORE {
    my ($self,$field,$newval) = @_;
    my $member_func = "swig_${field}_set";
    $self->$member_func($newval);
}

sub this {
    my $ptr = shift;
    return tied(%$ptr);
}


# ------- FUNCTION WRAPPERS --------

package Math::GSL::BSpline;

*gsl_error = *Math::GSL::BSplinec::gsl_error;
*gsl_stream_printf = *Math::GSL::BSplinec::gsl_stream_printf;
*gsl_strerror = *Math::GSL::BSplinec::gsl_strerror;
*gsl_set_error_handler = *Math::GSL::BSplinec::gsl_set_error_handler;
*gsl_set_error_handler_off = *Math::GSL::BSplinec::gsl_set_error_handler_off;
*gsl_set_stream_handler = *Math::GSL::BSplinec::gsl_set_stream_handler;
*gsl_set_stream = *Math::GSL::BSplinec::gsl_set_stream;
*gsl_bspline_alloc = *Math::GSL::BSplinec::gsl_bspline_alloc;
*gsl_bspline_free = *Math::GSL::BSplinec::gsl_bspline_free;
*gsl_bspline_ncoeffs = *Math::GSL::BSplinec::gsl_bspline_ncoeffs;
*gsl_bspline_order = *Math::GSL::BSplinec::gsl_bspline_order;
*gsl_bspline_nbreak = *Math::GSL::BSplinec::gsl_bspline_nbreak;
*gsl_bspline_breakpoint = *Math::GSL::BSplinec::gsl_bspline_breakpoint;
*gsl_bspline_greville_abscissa = *Math::GSL::BSplinec::gsl_bspline_greville_abscissa;
*gsl_bspline_knots = *Math::GSL::BSplinec::gsl_bspline_knots;
*gsl_bspline_knots_uniform = *Math::GSL::BSplinec::gsl_bspline_knots_uniform;
*gsl_bspline_knots_greville = *Math::GSL::BSplinec::gsl_bspline_knots_greville;
*gsl_bspline_eval = *Math::GSL::BSplinec::gsl_bspline_eval;

############# Class : Math::GSL::BSpline::gsl_function_struct ##############

package Math::GSL::BSpline::gsl_function_struct;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( Math::GSL::BSpline );
%OWNER = ();
%ITERATORS = ();
*swig_function_get = *Math::GSL::BSplinec::gsl_function_struct_function_get;
*swig_function_set = *Math::GSL::BSplinec::gsl_function_struct_function_set;
*swig_params_get = *Math::GSL::BSplinec::gsl_function_struct_params_get;
*swig_params_set = *Math::GSL::BSplinec::gsl_function_struct_params_set;
sub new {
    my $pkg = shift;
    my $self = Math::GSL::BSplinec::new_gsl_function_struct(@_);
    bless $self, $pkg if defined($self);
}

sub DESTROY {
    return unless $_[0]->isa('HASH');
    my $self = tied(%{$_[0]});
    return unless defined $self;
    delete $ITERATORS{$self};
    if (exists $OWNER{$self}) {
        Math::GSL::BSplinec::delete_gsl_function_struct($self);
        delete $OWNER{$self};
    }
}

sub DISOWN {
    my $self = shift;
    my $ptr = tied(%$self);
    delete $OWNER{$ptr};
}

sub ACQUIRE {
    my $self = shift;
    my $ptr = tied(%$self);
    $OWNER{$ptr} = 1;
}


############# Class : Math::GSL::BSpline::gsl_function_fdf_struct ##############

package Math::GSL::BSpline::gsl_function_fdf_struct;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( Math::GSL::BSpline );
%OWNER = ();
%ITERATORS = ();
*swig_f_get = *Math::GSL::BSplinec::gsl_function_fdf_struct_f_get;
*swig_f_set = *Math::GSL::BSplinec::gsl_function_fdf_struct_f_set;
*swig_df_get = *Math::GSL::BSplinec::gsl_function_fdf_struct_df_get;
*swig_df_set = *Math::GSL::BSplinec::gsl_function_fdf_struct_df_set;
*swig_fdf_get = *Math::GSL::BSplinec::gsl_function_fdf_struct_fdf_get;
*swig_fdf_set = *Math::GSL::BSplinec::gsl_function_fdf_struct_fdf_set;
*swig_params_get = *Math::GSL::BSplinec::gsl_function_fdf_struct_params_get;
*swig_params_set = *Math::GSL::BSplinec::gsl_function_fdf_struct_params_set;
sub new {
    my $pkg = shift;
    my $self = Math::GSL::BSplinec::new_gsl_function_fdf_struct(@_);
    bless $self, $pkg if defined($self);
}

sub DESTROY {
    return unless $_[0]->isa('HASH');
    my $self = tied(%{$_[0]});
    return unless defined $self;
    delete $ITERATORS{$self};
    if (exists $OWNER{$self}) {
        Math::GSL::BSplinec::delete_gsl_function_fdf_struct($self);
        delete $OWNER{$self};
    }
}

sub DISOWN {
    my $self = shift;
    my $ptr = tied(%$self);
    delete $OWNER{$ptr};
}

sub ACQUIRE {
    my $self = shift;
    my $ptr = tied(%$self);
    $OWNER{$ptr} = 1;
}


############# Class : Math::GSL::BSpline::gsl_function_vec_struct ##############

package Math::GSL::BSpline::gsl_function_vec_struct;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( Math::GSL::BSpline );
%OWNER = ();
%ITERATORS = ();
*swig_function_get = *Math::GSL::BSplinec::gsl_function_vec_struct_function_get;
*swig_function_set = *Math::GSL::BSplinec::gsl_function_vec_struct_function_set;
*swig_params_get = *Math::GSL::BSplinec::gsl_function_vec_struct_params_get;
*swig_params_set = *Math::GSL::BSplinec::gsl_function_vec_struct_params_set;
sub new {
    my $pkg = shift;
    my $self = Math::GSL::BSplinec::new_gsl_function_vec_struct(@_);
    bless $self, $pkg if defined($self);
}

sub DESTROY {
    return unless $_[0]->isa('HASH');
    my $self = tied(%{$_[0]});
    return unless defined $self;
    delete $ITERATORS{$self};
    if (exists $OWNER{$self}) {
        Math::GSL::BSplinec::delete_gsl_function_vec_struct($self);
        delete $OWNER{$self};
    }
}

sub DISOWN {
    my $self = shift;
    my $ptr = tied(%$self);
    delete $OWNER{$ptr};
}

sub ACQUIRE {
    my $self = shift;
    my $ptr = tied(%$self);
    $OWNER{$ptr} = 1;
}


# ------- VARIABLE STUBS --------

package Math::GSL::BSpline;

*GSL_VERSION = *Math::GSL::BSplinec::GSL_VERSION;
*GSL_MAJOR_VERSION = *Math::GSL::BSplinec::GSL_MAJOR_VERSION;
*GSL_MINOR_VERSION = *Math::GSL::BSplinec::GSL_MINOR_VERSION;
*GSL_POSZERO = *Math::GSL::BSplinec::GSL_POSZERO;
*GSL_NEGZERO = *Math::GSL::BSplinec::GSL_NEGZERO;
*GSL_SUCCESS = *Math::GSL::BSplinec::GSL_SUCCESS;
*GSL_FAILURE = *Math::GSL::BSplinec::GSL_FAILURE;
*GSL_CONTINUE = *Math::GSL::BSplinec::GSL_CONTINUE;
*GSL_EDOM = *Math::GSL::BSplinec::GSL_EDOM;
*GSL_ERANGE = *Math::GSL::BSplinec::GSL_ERANGE;
*GSL_EFAULT = *Math::GSL::BSplinec::GSL_EFAULT;
*GSL_EINVAL = *Math::GSL::BSplinec::GSL_EINVAL;
*GSL_EFAILED = *Math::GSL::BSplinec::GSL_EFAILED;
*GSL_EFACTOR = *Math::GSL::BSplinec::GSL_EFACTOR;
*GSL_ESANITY = *Math::GSL::BSplinec::GSL_ESANITY;
*GSL_ENOMEM = *Math::GSL::BSplinec::GSL_ENOMEM;
*GSL_EBADFUNC = *Math::GSL::BSplinec::GSL_EBADFUNC;
*GSL_ERUNAWAY = *Math::GSL::BSplinec::GSL_ERUNAWAY;
*GSL_EMAXITER = *Math::GSL::BSplinec::GSL_EMAXITER;
*GSL_EZERODIV = *Math::GSL::BSplinec::GSL_EZERODIV;
*GSL_EBADTOL = *Math::GSL::BSplinec::GSL_EBADTOL;
*GSL_ETOL = *Math::GSL::BSplinec::GSL_ETOL;
*GSL_EUNDRFLW = *Math::GSL::BSplinec::GSL_EUNDRFLW;
*GSL_EOVRFLW = *Math::GSL::BSplinec::GSL_EOVRFLW;
*GSL_ELOSS = *Math::GSL::BSplinec::GSL_ELOSS;
*GSL_EROUND = *Math::GSL::BSplinec::GSL_EROUND;
*GSL_EBADLEN = *Math::GSL::BSplinec::GSL_EBADLEN;
*GSL_ENOTSQR = *Math::GSL::BSplinec::GSL_ENOTSQR;
*GSL_ESING = *Math::GSL::BSplinec::GSL_ESING;
*GSL_EDIVERGE = *Math::GSL::BSplinec::GSL_EDIVERGE;
*GSL_EUNSUP = *Math::GSL::BSplinec::GSL_EUNSUP;
*GSL_EUNIMPL = *Math::GSL::BSplinec::GSL_EUNIMPL;
*GSL_ECACHE = *Math::GSL::BSplinec::GSL_ECACHE;
*GSL_ETABLE = *Math::GSL::BSplinec::GSL_ETABLE;
*GSL_ENOPROG = *Math::GSL::BSplinec::GSL_ENOPROG;
*GSL_ENOPROGJ = *Math::GSL::BSplinec::GSL_ENOPROGJ;
*GSL_ETOLF = *Math::GSL::BSplinec::GSL_ETOLF;
*GSL_ETOLX = *Math::GSL::BSplinec::GSL_ETOLX;
*GSL_ETOLG = *Math::GSL::BSplinec::GSL_ETOLG;
*GSL_EOF = *Math::GSL::BSplinec::GSL_EOF;
*GSL_DISABLE_DEPRECATED = *Math::GSL::BSplinec::GSL_DISABLE_DEPRECATED;
*M_E = *Math::GSL::BSplinec::M_E;
*M_LOG2E = *Math::GSL::BSplinec::M_LOG2E;
*M_LOG10E = *Math::GSL::BSplinec::M_LOG10E;
*M_SQRT2 = *Math::GSL::BSplinec::M_SQRT2;
*M_SQRT1_2 = *Math::GSL::BSplinec::M_SQRT1_2;
*M_SQRT3 = *Math::GSL::BSplinec::M_SQRT3;
*M_PI = *Math::GSL::BSplinec::M_PI;
*M_PI_2 = *Math::GSL::BSplinec::M_PI_2;
*M_PI_4 = *Math::GSL::BSplinec::M_PI_4;
*M_SQRTPI = *Math::GSL::BSplinec::M_SQRTPI;
*M_2_SQRTPI = *Math::GSL::BSplinec::M_2_SQRTPI;
*M_1_PI = *Math::GSL::BSplinec::M_1_PI;
*M_2_PI = *Math::GSL::BSplinec::M_2_PI;
*M_LN10 = *Math::GSL::BSplinec::M_LN10;
*M_LN2 = *Math::GSL::BSplinec::M_LN2;
*M_LNPI = *Math::GSL::BSplinec::M_LNPI;
*M_EULER = *Math::GSL::BSplinec::M_EULER;

@EXPORT_OK = qw/
               gsl_bspline_alloc
               gsl_bspline_free
               gsl_bspline_ncoeffs
               gsl_bspline_order
               gsl_bspline_nbreak
               gsl_bspline_breakpoint
               gsl_bspline_knots
               gsl_bspline_knots_uniform
               gsl_bspline_eval
             /;
%EXPORT_TAGS = ( all => [ @EXPORT_OK ] );

__END__

=encoding utf8

=head1 NAME

Math::GSL::BSpline - Functions for the computation of smoothing basis splines

=head1 SYNOPSIS

    use Math::GSL::BSpline qw/:all/;

=head1 DESCRIPTION

=over

=item gsl_bspline_alloc($k, $nbreak)

This function allocates a workspace for computing B-splines of order $k. The
number of breakpoints is given by $nbreak. This leads to n = $nbreak + $k - 2
basis functions. Cubic B-splines are specified by $k = 4.

=item gsl_bspline_free($w)

This function frees the memory associated with the workspace $w.

=item gsl_bspline_ncoeffs($w)

This function returns the number of B-spline coefficients given by n = nbreak + k - 2.

=item gsl_bspline_order

=item gsl_bspline_nbreak

=item gsl_bspline_breakpoint

=item gsl_bspline_knots($breakpts, $w)

This function computes the knots associated with the given breakpoints inside
the vector $breakpts and stores them internally in $w->{knots}.

=item gsl_bspline_knots_uniform($a, $b, $w)

This function assumes uniformly spaced breakpoints on [$a,$b] and constructs
the corresponding knot vector using the previously specified nbreak parameter.
The knots are stored in $w->{knots}.

=item gsl_bspline_eval($x, $B, $w)

This function evaluates all B-spline basis functions at the position $x and
stores them in the vector $B, so that the ith element of $B is B_i($x). $B must
be of length n = $nbreak + $k - 2. This value may also be obtained by calling
gsl_bspline_ncoeffs. It is far more efficient to compute all of the basis
functions at once than to compute them individually, due to the nature of the
defining recurrence relation.

For more information on the functions, we refer you to the GSL official documentation:
http://www.gnu.org/software/gsl/manual/html_node/

=back

=head1 EXAMPLES

Coming soon.

=head1 AUTHORS

Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut

1;