File: Diff.pm.2.0

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 (179 lines) | stat: -rw-r--r-- 5,230 bytes parent folder | download | duplicates (13)
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
# 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::Diff;
use base qw(Exporter);
use base qw(DynaLoader);
package Math::GSL::Diffc;
bootstrap Math::GSL::Diff;
package Math::GSL::Diff;
@EXPORT = qw();

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

package Math::GSL::Diff;

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::Diff;

*gsl_error = *Math::GSL::Diffc::gsl_error;
*gsl_stream_printf = *Math::GSL::Diffc::gsl_stream_printf;
*gsl_strerror = *Math::GSL::Diffc::gsl_strerror;
*gsl_set_error_handler = *Math::GSL::Diffc::gsl_set_error_handler;
*gsl_set_error_handler_off = *Math::GSL::Diffc::gsl_set_error_handler_off;
*gsl_set_stream_handler = *Math::GSL::Diffc::gsl_set_stream_handler;
*gsl_set_stream = *Math::GSL::Diffc::gsl_set_stream;
*gsl_diff_central = *Math::GSL::Diffc::gsl_diff_central;
*gsl_diff_backward = *Math::GSL::Diffc::gsl_diff_backward;
*gsl_diff_forward = *Math::GSL::Diffc::gsl_diff_forward;

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

package Math::GSL::Diff;

*GSL_VERSION = *Math::GSL::Diffc::GSL_VERSION;
*GSL_MAJOR_VERSION = *Math::GSL::Diffc::GSL_MAJOR_VERSION;
*GSL_MINOR_VERSION = *Math::GSL::Diffc::GSL_MINOR_VERSION;
*GSL_POSZERO = *Math::GSL::Diffc::GSL_POSZERO;
*GSL_NEGZERO = *Math::GSL::Diffc::GSL_NEGZERO;
*GSL_SUCCESS = *Math::GSL::Diffc::GSL_SUCCESS;
*GSL_FAILURE = *Math::GSL::Diffc::GSL_FAILURE;
*GSL_CONTINUE = *Math::GSL::Diffc::GSL_CONTINUE;
*GSL_EDOM = *Math::GSL::Diffc::GSL_EDOM;
*GSL_ERANGE = *Math::GSL::Diffc::GSL_ERANGE;
*GSL_EFAULT = *Math::GSL::Diffc::GSL_EFAULT;
*GSL_EINVAL = *Math::GSL::Diffc::GSL_EINVAL;
*GSL_EFAILED = *Math::GSL::Diffc::GSL_EFAILED;
*GSL_EFACTOR = *Math::GSL::Diffc::GSL_EFACTOR;
*GSL_ESANITY = *Math::GSL::Diffc::GSL_ESANITY;
*GSL_ENOMEM = *Math::GSL::Diffc::GSL_ENOMEM;
*GSL_EBADFUNC = *Math::GSL::Diffc::GSL_EBADFUNC;
*GSL_ERUNAWAY = *Math::GSL::Diffc::GSL_ERUNAWAY;
*GSL_EMAXITER = *Math::GSL::Diffc::GSL_EMAXITER;
*GSL_EZERODIV = *Math::GSL::Diffc::GSL_EZERODIV;
*GSL_EBADTOL = *Math::GSL::Diffc::GSL_EBADTOL;
*GSL_ETOL = *Math::GSL::Diffc::GSL_ETOL;
*GSL_EUNDRFLW = *Math::GSL::Diffc::GSL_EUNDRFLW;
*GSL_EOVRFLW = *Math::GSL::Diffc::GSL_EOVRFLW;
*GSL_ELOSS = *Math::GSL::Diffc::GSL_ELOSS;
*GSL_EROUND = *Math::GSL::Diffc::GSL_EROUND;
*GSL_EBADLEN = *Math::GSL::Diffc::GSL_EBADLEN;
*GSL_ENOTSQR = *Math::GSL::Diffc::GSL_ENOTSQR;
*GSL_ESING = *Math::GSL::Diffc::GSL_ESING;
*GSL_EDIVERGE = *Math::GSL::Diffc::GSL_EDIVERGE;
*GSL_EUNSUP = *Math::GSL::Diffc::GSL_EUNSUP;
*GSL_EUNIMPL = *Math::GSL::Diffc::GSL_EUNIMPL;
*GSL_ECACHE = *Math::GSL::Diffc::GSL_ECACHE;
*GSL_ETABLE = *Math::GSL::Diffc::GSL_ETABLE;
*GSL_ENOPROG = *Math::GSL::Diffc::GSL_ENOPROG;
*GSL_ENOPROGJ = *Math::GSL::Diffc::GSL_ENOPROGJ;
*GSL_ETOLF = *Math::GSL::Diffc::GSL_ETOLF;
*GSL_ETOLX = *Math::GSL::Diffc::GSL_ETOLX;
*GSL_ETOLG = *Math::GSL::Diffc::GSL_ETOLG;
*GSL_EOF = *Math::GSL::Diffc::GSL_EOF;

@EXPORT_OK = qw/
               gsl_diff_central
               gsl_diff_backward
               gsl_diff_forward
             /;
%EXPORT_TAGS = ( all => [ @EXPORT_OK ] );

__END__

=encoding utf8

=head1 NAME

Math::GSL::Diff - Numerical differentiation routines

=head1 SYNOPSIS

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

=head1 DESCRIPTION

Here is a list of all the functions included in this module :

=over

=item C<gsl_diff_central>

This function computes the numerical derivative of the function f
at the point x using an adaptive central difference algorithm.
The result is an array where the first position is an error code (0 for success),
the second is derivative value, and the third is an estimate of its absolute error.

   my ($success, $result, $error) =
         gsl_diff_central(sub { return $_[0] ** 1.5 }, 2.0);

=item C<gsl_diff_backward>

This function computes the numerical derivative of the function f 
at the point x using an adaptive forward difference algorithm.
Its usage is similar to C<gsl_diff_central>.

   my ($success, $result, $error) =
          gsl_diff_backward(sub { return $_[0] ** 1.5 }, 0.0);


=item C<gsl_diff_forward>

This function computes the numerical derivative of the
function f at the point x using an adaptive backward difference algorithm.
Its usage is similar to C<gsl_diff_central>.

   my ($success, $result, $error) =
          gsl_diff_forward(sub { return $_[0] ** 1.5 }, 1.0);


=back

=head1 EXAMPLES

=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;