1# This file was automatically generated by SWIG (http://www.swig.org).
2# Version 4.0.1
3#
4# Do not make changes to this file unless you know what you are doing--modify
5# the SWIG interface file instead.
6
7package Math::GSL::NTuple;
8use base qw(Exporter);
9use base qw(DynaLoader);
10package Math::GSL::NTuplec;
11bootstrap Math::GSL::NTuple;
12package Math::GSL::NTuple;
13@EXPORT = qw();
14
15# ---------- BASE METHODS -------------
16
17package Math::GSL::NTuple;
18
19sub TIEHASH {
20    my ($classname,$obj) = @_;
21    return bless $obj, $classname;
22}
23
24sub CLEAR { }
25
26sub FIRSTKEY { }
27
28sub NEXTKEY { }
29
30sub FETCH {
31    my ($self,$field) = @_;
32    my $member_func = "swig_${field}_get";
33    $self->$member_func();
34}
35
36sub STORE {
37    my ($self,$field,$newval) = @_;
38    my $member_func = "swig_${field}_set";
39    $self->$member_func($newval);
40}
41
42sub this {
43    my $ptr = shift;
44    return tied(%$ptr);
45}
46
47
48# ------- FUNCTION WRAPPERS --------
49
50package Math::GSL::NTuple;
51
52*gsl_error = *Math::GSL::NTuplec::gsl_error;
53*gsl_stream_printf = *Math::GSL::NTuplec::gsl_stream_printf;
54*gsl_strerror = *Math::GSL::NTuplec::gsl_strerror;
55*gsl_set_error_handler = *Math::GSL::NTuplec::gsl_set_error_handler;
56*gsl_set_error_handler_off = *Math::GSL::NTuplec::gsl_set_error_handler_off;
57*gsl_set_stream_handler = *Math::GSL::NTuplec::gsl_set_stream_handler;
58*gsl_set_stream = *Math::GSL::NTuplec::gsl_set_stream;
59*gsl_ntuple_open = *Math::GSL::NTuplec::gsl_ntuple_open;
60*gsl_ntuple_create = *Math::GSL::NTuplec::gsl_ntuple_create;
61*gsl_ntuple_write = *Math::GSL::NTuplec::gsl_ntuple_write;
62*gsl_ntuple_read = *Math::GSL::NTuplec::gsl_ntuple_read;
63*gsl_ntuple_bookdata = *Math::GSL::NTuplec::gsl_ntuple_bookdata;
64*gsl_ntuple_project = *Math::GSL::NTuplec::gsl_ntuple_project;
65*gsl_ntuple_close = *Math::GSL::NTuplec::gsl_ntuple_close;
66*gsl_histogram_alloc = *Math::GSL::NTuplec::gsl_histogram_alloc;
67*gsl_histogram_calloc = *Math::GSL::NTuplec::gsl_histogram_calloc;
68*gsl_histogram_calloc_uniform = *Math::GSL::NTuplec::gsl_histogram_calloc_uniform;
69*gsl_histogram_free = *Math::GSL::NTuplec::gsl_histogram_free;
70*gsl_histogram_increment = *Math::GSL::NTuplec::gsl_histogram_increment;
71*gsl_histogram_accumulate = *Math::GSL::NTuplec::gsl_histogram_accumulate;
72*gsl_histogram_find = *Math::GSL::NTuplec::gsl_histogram_find;
73*gsl_histogram_get = *Math::GSL::NTuplec::gsl_histogram_get;
74*gsl_histogram_get_range = *Math::GSL::NTuplec::gsl_histogram_get_range;
75*gsl_histogram_max = *Math::GSL::NTuplec::gsl_histogram_max;
76*gsl_histogram_min = *Math::GSL::NTuplec::gsl_histogram_min;
77*gsl_histogram_bins = *Math::GSL::NTuplec::gsl_histogram_bins;
78*gsl_histogram_reset = *Math::GSL::NTuplec::gsl_histogram_reset;
79*gsl_histogram_calloc_range = *Math::GSL::NTuplec::gsl_histogram_calloc_range;
80*gsl_histogram_set_ranges = *Math::GSL::NTuplec::gsl_histogram_set_ranges;
81*gsl_histogram_set_ranges_uniform = *Math::GSL::NTuplec::gsl_histogram_set_ranges_uniform;
82*gsl_histogram_memcpy = *Math::GSL::NTuplec::gsl_histogram_memcpy;
83*gsl_histogram_clone = *Math::GSL::NTuplec::gsl_histogram_clone;
84*gsl_histogram_max_val = *Math::GSL::NTuplec::gsl_histogram_max_val;
85*gsl_histogram_max_bin = *Math::GSL::NTuplec::gsl_histogram_max_bin;
86*gsl_histogram_min_val = *Math::GSL::NTuplec::gsl_histogram_min_val;
87*gsl_histogram_min_bin = *Math::GSL::NTuplec::gsl_histogram_min_bin;
88*gsl_histogram_equal_bins_p = *Math::GSL::NTuplec::gsl_histogram_equal_bins_p;
89*gsl_histogram_add = *Math::GSL::NTuplec::gsl_histogram_add;
90*gsl_histogram_sub = *Math::GSL::NTuplec::gsl_histogram_sub;
91*gsl_histogram_mul = *Math::GSL::NTuplec::gsl_histogram_mul;
92*gsl_histogram_div = *Math::GSL::NTuplec::gsl_histogram_div;
93*gsl_histogram_scale = *Math::GSL::NTuplec::gsl_histogram_scale;
94*gsl_histogram_shift = *Math::GSL::NTuplec::gsl_histogram_shift;
95*gsl_histogram_sigma = *Math::GSL::NTuplec::gsl_histogram_sigma;
96*gsl_histogram_mean = *Math::GSL::NTuplec::gsl_histogram_mean;
97*gsl_histogram_sum = *Math::GSL::NTuplec::gsl_histogram_sum;
98*gsl_histogram_fwrite = *Math::GSL::NTuplec::gsl_histogram_fwrite;
99*gsl_histogram_fread = *Math::GSL::NTuplec::gsl_histogram_fread;
100*gsl_histogram_fprintf = *Math::GSL::NTuplec::gsl_histogram_fprintf;
101*gsl_histogram_fscanf = *Math::GSL::NTuplec::gsl_histogram_fscanf;
102*gsl_histogram_pdf_alloc = *Math::GSL::NTuplec::gsl_histogram_pdf_alloc;
103*gsl_histogram_pdf_init = *Math::GSL::NTuplec::gsl_histogram_pdf_init;
104*gsl_histogram_pdf_free = *Math::GSL::NTuplec::gsl_histogram_pdf_free;
105*gsl_histogram_pdf_sample = *Math::GSL::NTuplec::gsl_histogram_pdf_sample;
106
107############# Class : Math::GSL::NTuple::gsl_ntuple ##############
108
109package Math::GSL::NTuple::gsl_ntuple;
110use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
111@ISA = qw( Math::GSL::NTuple );
112%OWNER = ();
113%ITERATORS = ();
114*swig_file_get = *Math::GSL::NTuplec::gsl_ntuple_file_get;
115*swig_file_set = *Math::GSL::NTuplec::gsl_ntuple_file_set;
116*swig_ntuple_data_get = *Math::GSL::NTuplec::gsl_ntuple_ntuple_data_get;
117*swig_ntuple_data_set = *Math::GSL::NTuplec::gsl_ntuple_ntuple_data_set;
118*swig_size_get = *Math::GSL::NTuplec::gsl_ntuple_size_get;
119*swig_size_set = *Math::GSL::NTuplec::gsl_ntuple_size_set;
120sub new {
121    my $pkg = shift;
122    my $self = Math::GSL::NTuplec::new_gsl_ntuple(@_);
123    bless $self, $pkg if defined($self);
124}
125
126sub DESTROY {
127    return unless $_[0]->isa('HASH');
128    my $self = tied(%{$_[0]});
129    return unless defined $self;
130    delete $ITERATORS{$self};
131    if (exists $OWNER{$self}) {
132        Math::GSL::NTuplec::delete_gsl_ntuple($self);
133        delete $OWNER{$self};
134    }
135}
136
137sub DISOWN {
138    my $self = shift;
139    my $ptr = tied(%$self);
140    delete $OWNER{$ptr};
141}
142
143sub ACQUIRE {
144    my $self = shift;
145    my $ptr = tied(%$self);
146    $OWNER{$ptr} = 1;
147}
148
149
150############# Class : Math::GSL::NTuple::gsl_ntuple_select_fn ##############
151
152package Math::GSL::NTuple::gsl_ntuple_select_fn;
153use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
154@ISA = qw( Math::GSL::NTuple );
155%OWNER = ();
156%ITERATORS = ();
157*swig_function_get = *Math::GSL::NTuplec::gsl_ntuple_select_fn_function_get;
158*swig_function_set = *Math::GSL::NTuplec::gsl_ntuple_select_fn_function_set;
159*swig_params_get = *Math::GSL::NTuplec::gsl_ntuple_select_fn_params_get;
160*swig_params_set = *Math::GSL::NTuplec::gsl_ntuple_select_fn_params_set;
161sub new {
162    my $pkg = shift;
163    my $self = Math::GSL::NTuplec::new_gsl_ntuple_select_fn(@_);
164    bless $self, $pkg if defined($self);
165}
166
167sub DESTROY {
168    return unless $_[0]->isa('HASH');
169    my $self = tied(%{$_[0]});
170    return unless defined $self;
171    delete $ITERATORS{$self};
172    if (exists $OWNER{$self}) {
173        Math::GSL::NTuplec::delete_gsl_ntuple_select_fn($self);
174        delete $OWNER{$self};
175    }
176}
177
178sub DISOWN {
179    my $self = shift;
180    my $ptr = tied(%$self);
181    delete $OWNER{$ptr};
182}
183
184sub ACQUIRE {
185    my $self = shift;
186    my $ptr = tied(%$self);
187    $OWNER{$ptr} = 1;
188}
189
190
191############# Class : Math::GSL::NTuple::gsl_ntuple_value_fn ##############
192
193package Math::GSL::NTuple::gsl_ntuple_value_fn;
194use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
195@ISA = qw( Math::GSL::NTuple );
196%OWNER = ();
197%ITERATORS = ();
198*swig_function_get = *Math::GSL::NTuplec::gsl_ntuple_value_fn_function_get;
199*swig_function_set = *Math::GSL::NTuplec::gsl_ntuple_value_fn_function_set;
200*swig_params_get = *Math::GSL::NTuplec::gsl_ntuple_value_fn_params_get;
201*swig_params_set = *Math::GSL::NTuplec::gsl_ntuple_value_fn_params_set;
202sub new {
203    my $pkg = shift;
204    my $self = Math::GSL::NTuplec::new_gsl_ntuple_value_fn(@_);
205    bless $self, $pkg if defined($self);
206}
207
208sub DESTROY {
209    return unless $_[0]->isa('HASH');
210    my $self = tied(%{$_[0]});
211    return unless defined $self;
212    delete $ITERATORS{$self};
213    if (exists $OWNER{$self}) {
214        Math::GSL::NTuplec::delete_gsl_ntuple_value_fn($self);
215        delete $OWNER{$self};
216    }
217}
218
219sub DISOWN {
220    my $self = shift;
221    my $ptr = tied(%$self);
222    delete $OWNER{$ptr};
223}
224
225sub ACQUIRE {
226    my $self = shift;
227    my $ptr = tied(%$self);
228    $OWNER{$ptr} = 1;
229}
230
231
232############# Class : Math::GSL::NTuple::gsl_histogram ##############
233
234package Math::GSL::NTuple::gsl_histogram;
235use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
236@ISA = qw( Math::GSL::NTuple );
237%OWNER = ();
238%ITERATORS = ();
239*swig_n_get = *Math::GSL::NTuplec::gsl_histogram_n_get;
240*swig_n_set = *Math::GSL::NTuplec::gsl_histogram_n_set;
241*swig_range_get = *Math::GSL::NTuplec::gsl_histogram_range_get;
242*swig_range_set = *Math::GSL::NTuplec::gsl_histogram_range_set;
243*swig_bin_get = *Math::GSL::NTuplec::gsl_histogram_bin_get;
244*swig_bin_set = *Math::GSL::NTuplec::gsl_histogram_bin_set;
245sub new {
246    my $pkg = shift;
247    my $self = Math::GSL::NTuplec::new_gsl_histogram(@_);
248    bless $self, $pkg if defined($self);
249}
250
251sub DESTROY {
252    return unless $_[0]->isa('HASH');
253    my $self = tied(%{$_[0]});
254    return unless defined $self;
255    delete $ITERATORS{$self};
256    if (exists $OWNER{$self}) {
257        Math::GSL::NTuplec::delete_gsl_histogram($self);
258        delete $OWNER{$self};
259    }
260}
261
262sub DISOWN {
263    my $self = shift;
264    my $ptr = tied(%$self);
265    delete $OWNER{$ptr};
266}
267
268sub ACQUIRE {
269    my $self = shift;
270    my $ptr = tied(%$self);
271    $OWNER{$ptr} = 1;
272}
273
274
275############# Class : Math::GSL::NTuple::gsl_histogram_pdf ##############
276
277package Math::GSL::NTuple::gsl_histogram_pdf;
278use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
279@ISA = qw( Math::GSL::NTuple );
280%OWNER = ();
281%ITERATORS = ();
282*swig_n_get = *Math::GSL::NTuplec::gsl_histogram_pdf_n_get;
283*swig_n_set = *Math::GSL::NTuplec::gsl_histogram_pdf_n_set;
284*swig_range_get = *Math::GSL::NTuplec::gsl_histogram_pdf_range_get;
285*swig_range_set = *Math::GSL::NTuplec::gsl_histogram_pdf_range_set;
286*swig_sum_get = *Math::GSL::NTuplec::gsl_histogram_pdf_sum_get;
287*swig_sum_set = *Math::GSL::NTuplec::gsl_histogram_pdf_sum_set;
288sub new {
289    my $pkg = shift;
290    my $self = Math::GSL::NTuplec::new_gsl_histogram_pdf(@_);
291    bless $self, $pkg if defined($self);
292}
293
294sub DESTROY {
295    return unless $_[0]->isa('HASH');
296    my $self = tied(%{$_[0]});
297    return unless defined $self;
298    delete $ITERATORS{$self};
299    if (exists $OWNER{$self}) {
300        Math::GSL::NTuplec::delete_gsl_histogram_pdf($self);
301        delete $OWNER{$self};
302    }
303}
304
305sub DISOWN {
306    my $self = shift;
307    my $ptr = tied(%$self);
308    delete $OWNER{$ptr};
309}
310
311sub ACQUIRE {
312    my $self = shift;
313    my $ptr = tied(%$self);
314    $OWNER{$ptr} = 1;
315}
316
317
318# ------- VARIABLE STUBS --------
319
320package Math::GSL::NTuple;
321
322*GSL_VERSION = *Math::GSL::NTuplec::GSL_VERSION;
323*GSL_MAJOR_VERSION = *Math::GSL::NTuplec::GSL_MAJOR_VERSION;
324*GSL_MINOR_VERSION = *Math::GSL::NTuplec::GSL_MINOR_VERSION;
325*GSL_POSZERO = *Math::GSL::NTuplec::GSL_POSZERO;
326*GSL_NEGZERO = *Math::GSL::NTuplec::GSL_NEGZERO;
327*GSL_SUCCESS = *Math::GSL::NTuplec::GSL_SUCCESS;
328*GSL_FAILURE = *Math::GSL::NTuplec::GSL_FAILURE;
329*GSL_CONTINUE = *Math::GSL::NTuplec::GSL_CONTINUE;
330*GSL_EDOM = *Math::GSL::NTuplec::GSL_EDOM;
331*GSL_ERANGE = *Math::GSL::NTuplec::GSL_ERANGE;
332*GSL_EFAULT = *Math::GSL::NTuplec::GSL_EFAULT;
333*GSL_EINVAL = *Math::GSL::NTuplec::GSL_EINVAL;
334*GSL_EFAILED = *Math::GSL::NTuplec::GSL_EFAILED;
335*GSL_EFACTOR = *Math::GSL::NTuplec::GSL_EFACTOR;
336*GSL_ESANITY = *Math::GSL::NTuplec::GSL_ESANITY;
337*GSL_ENOMEM = *Math::GSL::NTuplec::GSL_ENOMEM;
338*GSL_EBADFUNC = *Math::GSL::NTuplec::GSL_EBADFUNC;
339*GSL_ERUNAWAY = *Math::GSL::NTuplec::GSL_ERUNAWAY;
340*GSL_EMAXITER = *Math::GSL::NTuplec::GSL_EMAXITER;
341*GSL_EZERODIV = *Math::GSL::NTuplec::GSL_EZERODIV;
342*GSL_EBADTOL = *Math::GSL::NTuplec::GSL_EBADTOL;
343*GSL_ETOL = *Math::GSL::NTuplec::GSL_ETOL;
344*GSL_EUNDRFLW = *Math::GSL::NTuplec::GSL_EUNDRFLW;
345*GSL_EOVRFLW = *Math::GSL::NTuplec::GSL_EOVRFLW;
346*GSL_ELOSS = *Math::GSL::NTuplec::GSL_ELOSS;
347*GSL_EROUND = *Math::GSL::NTuplec::GSL_EROUND;
348*GSL_EBADLEN = *Math::GSL::NTuplec::GSL_EBADLEN;
349*GSL_ENOTSQR = *Math::GSL::NTuplec::GSL_ENOTSQR;
350*GSL_ESING = *Math::GSL::NTuplec::GSL_ESING;
351*GSL_EDIVERGE = *Math::GSL::NTuplec::GSL_EDIVERGE;
352*GSL_EUNSUP = *Math::GSL::NTuplec::GSL_EUNSUP;
353*GSL_EUNIMPL = *Math::GSL::NTuplec::GSL_EUNIMPL;
354*GSL_ECACHE = *Math::GSL::NTuplec::GSL_ECACHE;
355*GSL_ETABLE = *Math::GSL::NTuplec::GSL_ETABLE;
356*GSL_ENOPROG = *Math::GSL::NTuplec::GSL_ENOPROG;
357*GSL_ENOPROGJ = *Math::GSL::NTuplec::GSL_ENOPROGJ;
358*GSL_ETOLF = *Math::GSL::NTuplec::GSL_ETOLF;
359*GSL_ETOLX = *Math::GSL::NTuplec::GSL_ETOLX;
360*GSL_ETOLG = *Math::GSL::NTuplec::GSL_ETOLG;
361*GSL_EOF = *Math::GSL::NTuplec::GSL_EOF;
362
363use Data::Dumper;
364use Carp qw/croak/;
365use Math::GSL::Errno qw/:all/;
366
367@EXPORT_OK = qw/
368               gsl_ntuple_open
369               gsl_ntuple_create
370               gsl_ntuple_write
371               gsl_ntuple_read
372               gsl_ntuple_bookdata
373               gsl_ntuple_project
374               gsl_ntuple_close
375             /;
376%EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
377
378=encoding utf8
379
380=head1 NAME
381
382Math::GSL::NTuple - Functions for creating and manipulating ntuples, sets of values
383
384=head1 SYNOPSIS
385
386This module is partially implemented. Patches Welcome!
387
388    use Math::GSL::NTuple qw /:all/;
389
390=head1 DESCRIPTION
391
392Here is a list of all the functions in this module :
393
394=over
395
396=cut
397
398sub new
399{
400    my ($class,$values) = @_;
401    my $this = {};
402    my $ntuple = Math::GSL::NTuple::gsl_ntuple->new;
403    $this->{_ntuple} = $ntuple;
404
405    bless $this, $class;
406}
407
408sub raw
409{
410    return (shift)->{_ntuple};
411}
412
413=item * <gsl_ntuple_open($filename, $ntuple_data, $size)>
414
415This function opens an existing ntuple file $filename for reading and returns a
416pointer to a corresponding ntuple struct. The ntuples in the file must have size
417$size. A pointer to memory for the current ntuple row $ntuple_data, which is an
418array reference, must be supplied -- this is used to copy ntuples in and out of
419the file.
420
421=item * <gsl_ntuple_create>
422
423This function creates a new write-only ntuple file $filename for ntuples of size
424$size and returns a pointer to the newly created ntuple struct. Any existing
425file with the same name is truncated to zero length and overwritten. A pointer
426to memory for the current ntuple row $ntuple_data, which is an array reference,
427must be supplied -- this is used to copy ntuples in and out of the file.
428
429
430=item * <gsl_ntuple_write($ntuple)>
431
432This function writes the current $ntuple $ntuple->{ntuple_data} of size
433$ntuple->{size} to the corresponding file.
434
435=item * <gsl_ntuple_bookdata($ntuple)>
436
437This function is a synonym for gsl_ntuple_write.
438
439=item * <gsl_ntuple_read($ntuple)>
440
441This function reads the current row of the ntuple file for ntuple and stores the
442values in $ntuple->{data}.
443
444=item * <gsl_ntuple_project()>
445
446=item * <gsl_ntuple_close($ntuple)>
447
448This function closes the ntuple file ntuple and frees its associated allocated
449memory.
450
451=back
452
453For more informations on the functions, we refer you to the GSL official
454documentation: L<http://www.gnu.org/software/gsl/manual/html_node/>
455
456=head1 AUTHORS
457
458Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
459
460=head1 COPYRIGHT AND LICENSE
461
462Copyright (C) 2008-2021 Jonathan "Duke" Leto and Thierry Moisan
463
464This program is free software; you can redistribute it and/or modify it
465under the same terms as Perl itself.
466
467=cut
468
4691;
470