Better error message in double * typemap and refactor FFT tests
[Math-GSL.git] / Deriv.i
blobe00e89a87fa45bd4afb0c510052d9de39530bec3
1 %module "Math::GSL::Deriv"
2 // Danger Will Robinson, for realz!
4 %include "typemaps.i"
5 %include "gsl_typemaps.i"
6 %typemap(argout) (const gsl_function *f,
7 double x, double h,
8 double *result, double *abserr) {
9 SV ** sv;
10 AV* av = newAV();
12 sv = hv_fetch(Callbacks, (char*)&$input, sizeof($input), FALSE );
13 if (sv == (SV**)NULL)
14 croak("Math::GSL(argout) : Missing callback!\n");
15 dSP;
17 PUSHMARK(SP);
18 // these are the arguments passed to the callback
19 XPUSHs(sv_2mortal(newSViv((int)$2)));
20 PUTBACK;
22 /* This actually calls the perl subroutine */
23 call_sv(*sv, G_SCALAR);
25 av_push(av, newSVnv((double) *$4));
26 av_push(av, newSVnv((double) *$5));
27 $result = sv_2mortal( newRV_noinc( (SV*) av) );
28 if (argvi >= items) {
29 EXTEND(SP,1);
31 argvi++;
35 %typemap(in) void * {
36 $1 = (double *) $input;
39 #include "gsl/gsl_math.h"
40 #include "gsl/gsl_deriv.h"
43 %include "gsl/gsl_math.h"
44 %include "gsl/gsl_deriv.h"
46 %perlcode %{
47 @EXPORT_OK = qw/
48 gsl_deriv_central
49 gsl_deriv_backward
50 gsl_deriv_forward
52 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
54 __END__
56 =head1 NAME
58 Math::GSL::Deriv - Functions to compute numerical derivatives by finite differencing
60 =head1 SYNOPSIS
62 This module is not yet implemented. Patches Welcome!
64 use Math::GSL::Deriv qw /:all/;
66 =head1 DESCRIPTION
68 Here is a list of all the functions in this module :
70 =over
72 =item * C<gsl_deriv_central>
74 =item * C<gsl_deriv_backward>
76 =item * C<gsl_deriv_forward>
78 =back
80 For more informations on the functions, we refer you to the GSL offcial
81 documentation: L<http://www.gnu.org/software/gsl/manual/html_node/>
83 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
86 =head1 AUTHORS
88 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
90 =head1 COPYRIGHT AND LICENSE
92 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
94 This program is free software; you can redistribute it and/or modify it
95 under the same terms as Perl itself.
97 =cut