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::Poly;
8use base qw(Exporter);
9use base qw(DynaLoader);
10package Math::GSL::Polyc;
11bootstrap Math::GSL::Poly;
12package Math::GSL::Poly;
13@EXPORT = qw();
14
15# ---------- BASE METHODS -------------
16
17package Math::GSL::Poly;
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::Poly;
51
52*gsl_error = *Math::GSL::Polyc::gsl_error;
53*gsl_stream_printf = *Math::GSL::Polyc::gsl_stream_printf;
54*gsl_strerror = *Math::GSL::Polyc::gsl_strerror;
55*gsl_set_error_handler = *Math::GSL::Polyc::gsl_set_error_handler;
56*gsl_set_error_handler_off = *Math::GSL::Polyc::gsl_set_error_handler_off;
57*gsl_set_stream_handler = *Math::GSL::Polyc::gsl_set_stream_handler;
58*gsl_set_stream = *Math::GSL::Polyc::gsl_set_stream;
59*gsl_poly_eval = *Math::GSL::Polyc::gsl_poly_eval;
60*gsl_poly_complex_eval = *Math::GSL::Polyc::gsl_poly_complex_eval;
61*gsl_complex_poly_complex_eval = *Math::GSL::Polyc::gsl_complex_poly_complex_eval;
62*gsl_poly_eval_derivs = *Math::GSL::Polyc::gsl_poly_eval_derivs;
63*gsl_poly_dd_init = *Math::GSL::Polyc::gsl_poly_dd_init;
64*gsl_poly_dd_eval = *Math::GSL::Polyc::gsl_poly_dd_eval;
65*gsl_poly_dd_taylor = *Math::GSL::Polyc::gsl_poly_dd_taylor;
66*gsl_poly_dd_hermite_init = *Math::GSL::Polyc::gsl_poly_dd_hermite_init;
67*gsl_poly_solve_quadratic = *Math::GSL::Polyc::gsl_poly_solve_quadratic;
68*gsl_poly_complex_solve_quadratic = *Math::GSL::Polyc::gsl_poly_complex_solve_quadratic;
69*gsl_poly_solve_cubic = *Math::GSL::Polyc::gsl_poly_solve_cubic;
70*gsl_poly_complex_solve_cubic = *Math::GSL::Polyc::gsl_poly_complex_solve_cubic;
71*gsl_poly_complex_workspace_alloc = *Math::GSL::Polyc::gsl_poly_complex_workspace_alloc;
72*gsl_poly_complex_workspace_free = *Math::GSL::Polyc::gsl_poly_complex_workspace_free;
73*gsl_poly_complex_solve = *Math::GSL::Polyc::gsl_poly_complex_solve;
74*gsl_complex_polar = *Math::GSL::Polyc::gsl_complex_polar;
75*gsl_complex_rect = *Math::GSL::Polyc::gsl_complex_rect;
76*gsl_complex_arg = *Math::GSL::Polyc::gsl_complex_arg;
77*gsl_complex_abs = *Math::GSL::Polyc::gsl_complex_abs;
78*gsl_complex_abs2 = *Math::GSL::Polyc::gsl_complex_abs2;
79*gsl_complex_logabs = *Math::GSL::Polyc::gsl_complex_logabs;
80*gsl_complex_add = *Math::GSL::Polyc::gsl_complex_add;
81*gsl_complex_sub = *Math::GSL::Polyc::gsl_complex_sub;
82*gsl_complex_mul = *Math::GSL::Polyc::gsl_complex_mul;
83*gsl_complex_div = *Math::GSL::Polyc::gsl_complex_div;
84*gsl_complex_add_real = *Math::GSL::Polyc::gsl_complex_add_real;
85*gsl_complex_sub_real = *Math::GSL::Polyc::gsl_complex_sub_real;
86*gsl_complex_mul_real = *Math::GSL::Polyc::gsl_complex_mul_real;
87*gsl_complex_div_real = *Math::GSL::Polyc::gsl_complex_div_real;
88*gsl_complex_add_imag = *Math::GSL::Polyc::gsl_complex_add_imag;
89*gsl_complex_sub_imag = *Math::GSL::Polyc::gsl_complex_sub_imag;
90*gsl_complex_mul_imag = *Math::GSL::Polyc::gsl_complex_mul_imag;
91*gsl_complex_div_imag = *Math::GSL::Polyc::gsl_complex_div_imag;
92*gsl_complex_conjugate = *Math::GSL::Polyc::gsl_complex_conjugate;
93*gsl_complex_inverse = *Math::GSL::Polyc::gsl_complex_inverse;
94*gsl_complex_negative = *Math::GSL::Polyc::gsl_complex_negative;
95*gsl_complex_sqrt = *Math::GSL::Polyc::gsl_complex_sqrt;
96*gsl_complex_sqrt_real = *Math::GSL::Polyc::gsl_complex_sqrt_real;
97*gsl_complex_pow = *Math::GSL::Polyc::gsl_complex_pow;
98*gsl_complex_pow_real = *Math::GSL::Polyc::gsl_complex_pow_real;
99*gsl_complex_exp = *Math::GSL::Polyc::gsl_complex_exp;
100*gsl_complex_log = *Math::GSL::Polyc::gsl_complex_log;
101*gsl_complex_log10 = *Math::GSL::Polyc::gsl_complex_log10;
102*gsl_complex_log_b = *Math::GSL::Polyc::gsl_complex_log_b;
103*gsl_complex_sin = *Math::GSL::Polyc::gsl_complex_sin;
104*gsl_complex_cos = *Math::GSL::Polyc::gsl_complex_cos;
105*gsl_complex_sec = *Math::GSL::Polyc::gsl_complex_sec;
106*gsl_complex_csc = *Math::GSL::Polyc::gsl_complex_csc;
107*gsl_complex_tan = *Math::GSL::Polyc::gsl_complex_tan;
108*gsl_complex_cot = *Math::GSL::Polyc::gsl_complex_cot;
109*gsl_complex_arcsin = *Math::GSL::Polyc::gsl_complex_arcsin;
110*gsl_complex_arcsin_real = *Math::GSL::Polyc::gsl_complex_arcsin_real;
111*gsl_complex_arccos = *Math::GSL::Polyc::gsl_complex_arccos;
112*gsl_complex_arccos_real = *Math::GSL::Polyc::gsl_complex_arccos_real;
113*gsl_complex_arcsec = *Math::GSL::Polyc::gsl_complex_arcsec;
114*gsl_complex_arcsec_real = *Math::GSL::Polyc::gsl_complex_arcsec_real;
115*gsl_complex_arccsc = *Math::GSL::Polyc::gsl_complex_arccsc;
116*gsl_complex_arccsc_real = *Math::GSL::Polyc::gsl_complex_arccsc_real;
117*gsl_complex_arctan = *Math::GSL::Polyc::gsl_complex_arctan;
118*gsl_complex_arccot = *Math::GSL::Polyc::gsl_complex_arccot;
119*gsl_complex_sinh = *Math::GSL::Polyc::gsl_complex_sinh;
120*gsl_complex_cosh = *Math::GSL::Polyc::gsl_complex_cosh;
121*gsl_complex_sech = *Math::GSL::Polyc::gsl_complex_sech;
122*gsl_complex_csch = *Math::GSL::Polyc::gsl_complex_csch;
123*gsl_complex_tanh = *Math::GSL::Polyc::gsl_complex_tanh;
124*gsl_complex_coth = *Math::GSL::Polyc::gsl_complex_coth;
125*gsl_complex_arcsinh = *Math::GSL::Polyc::gsl_complex_arcsinh;
126*gsl_complex_arccosh = *Math::GSL::Polyc::gsl_complex_arccosh;
127*gsl_complex_arccosh_real = *Math::GSL::Polyc::gsl_complex_arccosh_real;
128*gsl_complex_arcsech = *Math::GSL::Polyc::gsl_complex_arcsech;
129*gsl_complex_arccsch = *Math::GSL::Polyc::gsl_complex_arccsch;
130*gsl_complex_arctanh = *Math::GSL::Polyc::gsl_complex_arctanh;
131*gsl_complex_arctanh_real = *Math::GSL::Polyc::gsl_complex_arctanh_real;
132*gsl_complex_arccoth = *Math::GSL::Polyc::gsl_complex_arccoth;
133
134############# Class : Math::GSL::Poly::gsl_poly_complex_workspace ##############
135
136package Math::GSL::Poly::gsl_poly_complex_workspace;
137use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
138@ISA = qw( Math::GSL::Poly );
139%OWNER = ();
140%ITERATORS = ();
141*swig_nc_get = *Math::GSL::Polyc::gsl_poly_complex_workspace_nc_get;
142*swig_nc_set = *Math::GSL::Polyc::gsl_poly_complex_workspace_nc_set;
143*swig_matrix_get = *Math::GSL::Polyc::gsl_poly_complex_workspace_matrix_get;
144*swig_matrix_set = *Math::GSL::Polyc::gsl_poly_complex_workspace_matrix_set;
145sub new {
146    my $pkg = shift;
147    my $self = Math::GSL::Polyc::new_gsl_poly_complex_workspace(@_);
148    bless $self, $pkg if defined($self);
149}
150
151sub DESTROY {
152    return unless $_[0]->isa('HASH');
153    my $self = tied(%{$_[0]});
154    return unless defined $self;
155    delete $ITERATORS{$self};
156    if (exists $OWNER{$self}) {
157        Math::GSL::Polyc::delete_gsl_poly_complex_workspace($self);
158        delete $OWNER{$self};
159    }
160}
161
162sub DISOWN {
163    my $self = shift;
164    my $ptr = tied(%$self);
165    delete $OWNER{$ptr};
166}
167
168sub ACQUIRE {
169    my $self = shift;
170    my $ptr = tied(%$self);
171    $OWNER{$ptr} = 1;
172}
173
174
175############# Class : Math::GSL::Poly::gsl_complex ##############
176
177package Math::GSL::Poly::gsl_complex;
178use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
179@ISA = qw( Math::GSL::Poly );
180%OWNER = ();
181%ITERATORS = ();
182*swig_dat_get = *Math::GSL::Polyc::gsl_complex_dat_get;
183*swig_dat_set = *Math::GSL::Polyc::gsl_complex_dat_set;
184sub new {
185    my $pkg = shift;
186    my $self = Math::GSL::Polyc::new_gsl_complex(@_);
187    bless $self, $pkg if defined($self);
188}
189
190sub DESTROY {
191    return unless $_[0]->isa('HASH');
192    my $self = tied(%{$_[0]});
193    return unless defined $self;
194    delete $ITERATORS{$self};
195    if (exists $OWNER{$self}) {
196        Math::GSL::Polyc::delete_gsl_complex($self);
197        delete $OWNER{$self};
198    }
199}
200
201sub DISOWN {
202    my $self = shift;
203    my $ptr = tied(%$self);
204    delete $OWNER{$ptr};
205}
206
207sub ACQUIRE {
208    my $self = shift;
209    my $ptr = tied(%$self);
210    $OWNER{$ptr} = 1;
211}
212
213
214############# Class : Math::GSL::Poly::gsl_complex_long_double ##############
215
216package Math::GSL::Poly::gsl_complex_long_double;
217use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
218@ISA = qw( Math::GSL::Poly );
219%OWNER = ();
220%ITERATORS = ();
221*swig_dat_get = *Math::GSL::Polyc::gsl_complex_long_double_dat_get;
222*swig_dat_set = *Math::GSL::Polyc::gsl_complex_long_double_dat_set;
223sub new {
224    my $pkg = shift;
225    my $self = Math::GSL::Polyc::new_gsl_complex_long_double(@_);
226    bless $self, $pkg if defined($self);
227}
228
229sub DESTROY {
230    return unless $_[0]->isa('HASH');
231    my $self = tied(%{$_[0]});
232    return unless defined $self;
233    delete $ITERATORS{$self};
234    if (exists $OWNER{$self}) {
235        Math::GSL::Polyc::delete_gsl_complex_long_double($self);
236        delete $OWNER{$self};
237    }
238}
239
240sub DISOWN {
241    my $self = shift;
242    my $ptr = tied(%$self);
243    delete $OWNER{$ptr};
244}
245
246sub ACQUIRE {
247    my $self = shift;
248    my $ptr = tied(%$self);
249    $OWNER{$ptr} = 1;
250}
251
252
253############# Class : Math::GSL::Poly::gsl_complex_float ##############
254
255package Math::GSL::Poly::gsl_complex_float;
256use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
257@ISA = qw( Math::GSL::Poly );
258%OWNER = ();
259%ITERATORS = ();
260*swig_dat_get = *Math::GSL::Polyc::gsl_complex_float_dat_get;
261*swig_dat_set = *Math::GSL::Polyc::gsl_complex_float_dat_set;
262sub new {
263    my $pkg = shift;
264    my $self = Math::GSL::Polyc::new_gsl_complex_float(@_);
265    bless $self, $pkg if defined($self);
266}
267
268sub DESTROY {
269    return unless $_[0]->isa('HASH');
270    my $self = tied(%{$_[0]});
271    return unless defined $self;
272    delete $ITERATORS{$self};
273    if (exists $OWNER{$self}) {
274        Math::GSL::Polyc::delete_gsl_complex_float($self);
275        delete $OWNER{$self};
276    }
277}
278
279sub DISOWN {
280    my $self = shift;
281    my $ptr = tied(%$self);
282    delete $OWNER{$ptr};
283}
284
285sub ACQUIRE {
286    my $self = shift;
287    my $ptr = tied(%$self);
288    $OWNER{$ptr} = 1;
289}
290
291
292# ------- VARIABLE STUBS --------
293
294package Math::GSL::Poly;
295
296*GSL_VERSION = *Math::GSL::Polyc::GSL_VERSION;
297*GSL_MAJOR_VERSION = *Math::GSL::Polyc::GSL_MAJOR_VERSION;
298*GSL_MINOR_VERSION = *Math::GSL::Polyc::GSL_MINOR_VERSION;
299*GSL_POSZERO = *Math::GSL::Polyc::GSL_POSZERO;
300*GSL_NEGZERO = *Math::GSL::Polyc::GSL_NEGZERO;
301*GSL_SUCCESS = *Math::GSL::Polyc::GSL_SUCCESS;
302*GSL_FAILURE = *Math::GSL::Polyc::GSL_FAILURE;
303*GSL_CONTINUE = *Math::GSL::Polyc::GSL_CONTINUE;
304*GSL_EDOM = *Math::GSL::Polyc::GSL_EDOM;
305*GSL_ERANGE = *Math::GSL::Polyc::GSL_ERANGE;
306*GSL_EFAULT = *Math::GSL::Polyc::GSL_EFAULT;
307*GSL_EINVAL = *Math::GSL::Polyc::GSL_EINVAL;
308*GSL_EFAILED = *Math::GSL::Polyc::GSL_EFAILED;
309*GSL_EFACTOR = *Math::GSL::Polyc::GSL_EFACTOR;
310*GSL_ESANITY = *Math::GSL::Polyc::GSL_ESANITY;
311*GSL_ENOMEM = *Math::GSL::Polyc::GSL_ENOMEM;
312*GSL_EBADFUNC = *Math::GSL::Polyc::GSL_EBADFUNC;
313*GSL_ERUNAWAY = *Math::GSL::Polyc::GSL_ERUNAWAY;
314*GSL_EMAXITER = *Math::GSL::Polyc::GSL_EMAXITER;
315*GSL_EZERODIV = *Math::GSL::Polyc::GSL_EZERODIV;
316*GSL_EBADTOL = *Math::GSL::Polyc::GSL_EBADTOL;
317*GSL_ETOL = *Math::GSL::Polyc::GSL_ETOL;
318*GSL_EUNDRFLW = *Math::GSL::Polyc::GSL_EUNDRFLW;
319*GSL_EOVRFLW = *Math::GSL::Polyc::GSL_EOVRFLW;
320*GSL_ELOSS = *Math::GSL::Polyc::GSL_ELOSS;
321*GSL_EROUND = *Math::GSL::Polyc::GSL_EROUND;
322*GSL_EBADLEN = *Math::GSL::Polyc::GSL_EBADLEN;
323*GSL_ENOTSQR = *Math::GSL::Polyc::GSL_ENOTSQR;
324*GSL_ESING = *Math::GSL::Polyc::GSL_ESING;
325*GSL_EDIVERGE = *Math::GSL::Polyc::GSL_EDIVERGE;
326*GSL_EUNSUP = *Math::GSL::Polyc::GSL_EUNSUP;
327*GSL_EUNIMPL = *Math::GSL::Polyc::GSL_EUNIMPL;
328*GSL_ECACHE = *Math::GSL::Polyc::GSL_ECACHE;
329*GSL_ETABLE = *Math::GSL::Polyc::GSL_ETABLE;
330*GSL_ENOPROG = *Math::GSL::Polyc::GSL_ENOPROG;
331*GSL_ENOPROGJ = *Math::GSL::Polyc::GSL_ENOPROGJ;
332*GSL_ETOLF = *Math::GSL::Polyc::GSL_ETOLF;
333*GSL_ETOLX = *Math::GSL::Polyc::GSL_ETOLX;
334*GSL_ETOLG = *Math::GSL::Polyc::GSL_ETOLG;
335*GSL_EOF = *Math::GSL::Polyc::GSL_EOF;
336
337
338@EXPORT_OK = qw/
339                gsl_poly_eval
340                gsl_poly_complex_eval
341                gsl_complex_poly_complex_eval
342                gsl_poly_dd_init
343                gsl_poly_dd_eval
344                gsl_poly_dd_taylor
345                gsl_poly_solve_quadratic
346                gsl_poly_complex_solve_quadratic
347                gsl_poly_solve_cubic
348                gsl_poly_complex_solve_cubic
349                gsl_poly_complex_workspace_alloc
350                gsl_poly_complex_workspace_free
351                gsl_poly_complex_solve
352                $GSL_POSZERO $GSL_NEGZERO $GSL_NAN
353             /;
354
355%EXPORT_TAGS = ( all => \@EXPORT_OK );
356
357__END__
358
359=encoding utf8
360
361=head1 NAME
362
363Math::GSL::Poly - Solve and evaluate polynomials
364
365=head1 SYNOPSIS
366
367    use Math::GSL::Poly qw/:all/;
368    my ($a,$b,$c) = (1,6,9);
369    my ($x0, $x1) = (0,0);
370    my $num_roots = gsl_poly_solve_quadratic( $a, $b, $c, \$x0, \$x1);
371    print "${a}*x**2 + ${b}*x + $c contains $num_roots roots which are $x0 and $x1. \n";
372
373=head1 DESCRIPTION
374
375Here is a list of all the functions included in this module :
376
377=over
378
379=item * gsl_poly_eval(@values, $length, $x)
380
381This function evaluates a polynomial with real coefficients for the real
382variable $x. $length is the number of elements inside @values. The function
383returns a complex number.
384
385=item * gsl_poly_complex_eval(@values, $length, $z)
386
387This function evaluates a polynomial with real coefficients for the complex
388variable $z. $length is the number of elements inside @valuesi. The function
389returns a complex number.
390
391=item * gsl_complex_poly_complex_eval(@values, $length, $z)
392
393This function evaluates a polynomial with real coefficients for the complex
394variable $z. $length is the number of elements inside @values. $length is the
395number of elements inside @values. The function returns a complex number.
396
397=item * gsl_poly_dd_init
398
399=item * gsl_poly_dd_eval
400
401=item * gsl_poly_dd_taylor
402
403=item * gsl_poly_solve_quadratic( $a, $b, $c, \$x0, \$x1)
404
405Find the real roots of the quadratic equation $a*x**2+$b*x+$c = 0, return the
406number of real root (either zero, one or two) and the real roots are returned
407by $x0, $x1 and $x2 which are deferenced.
408
409=item * gsl_poly_complex_solve_quadratic
410
411=item * gsl_poly_solve_cubic($a, $b, $c, \$x0, \$x1, \$x2)
412
413find the real roots of the cubic equation x**3+$a*x**2+$b*x+$c = 0, return the
414number of real root (either one or three) and the real roots are returned by
415$x0, $x1 and $x2 which are deferenced.
416
417=item * gsl_poly_complex_solve_cubic
418
419=item * gsl_poly_complex_workspace_alloc($n)
420
421This function allocates space for a gsl_poly_complex_workspace struct and a
422workspace suitable for solving a polynomial with $n coefficients using the
423routine gsl_poly_complex_solve.
424
425=item * gsl_poly_complex_workspace_free($w)
426
427This function frees all the memory associated with the workspace $w.
428
429=item * gsl_poly_complex_solve()
430
431=back
432
433For more informations on the functions, we refer you to the GSL official documentation:
434L<http://www.gnu.org/software/gsl/manual/html_node/>
435
436=head1 AUTHORS
437
438Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
439
440=head1 COPYRIGHT AND LICENSE
441
442Copyright (C) 2008-2021 Jonathan "Duke" Leto and Thierry Moisan
443
444This program is free software; you can redistribute it and/or modify it
445under the same terms as Perl itself.
446
447=cut
4481;
449