Adding a basic menu to tkplotdataset
[Math-GSL.git] / Deriv.i
blobe217415bbaa54ca25e1e70c78bea37d3a8946191
1 %module "Math::GSL::Deriv"
2 /*
3 struct gsl_function_struct
5 double (* function) (double x, void * params);
6 void * params;
7 };
9 typedef struct gsl_function_struct gsl_function ;
10 #define GSL_FN_EVAL(F,x) (*((F)->function))(x,(F)->params)
13 %include "typemaps.i"
14 %typemap(in) gsl_function * {
15 gsl_function F;
16 int count;
17 F.params = 0;
18 F.function = &xsquared;
20 if( !SvROK($input) ) {
21 croak("Math::GSL : not a reference value!");
23 //Perl_sv_dump( $input );
25 // does not work
26 //count = call_sv((SV*) $input, G_ARRAY);
27 $1 = &F;
31 typedef struct callback_t
33 SV * obj;
35 double xsquared(double x,void *params){
36 return x * x;
39 %typemap(in) void * {
40 printf("void * \n");
41 $1 = (double *) $input;
43 %typemap(in) double (*)(double,void *) {
44 fprintf(stderr,"input * %d \n", (int) $input);
45 //Perl_sv_dump( $input );
48 %apply double * OUTPUT { double *abserr, double *result };
51 #include "gsl/gsl_math.h"
52 #include "gsl/gsl_deriv.h"
55 %include "gsl/gsl_math.h"
56 %include "gsl/gsl_deriv.h"
58 %perlcode %{
59 @EXPORT_OK = qw/
60 gsl_deriv_central
61 gsl_deriv_backward
62 gsl_deriv_forward
64 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
66 __END__
68 =head1 NAME
70 Math::GSL::Deriv - Functions to compute numerical derivatives by finite differencing
72 =head1 SYNOPSIS
74 This module is not yet implemented. Patches Welcome!
76 use Math::GSL::Deriv qw /:all/;
78 =head1 DESCRIPTION
80 Here is a list of all the functions in this module :
82 =over
84 =item * C<gsl_deriv_central>
86 =item * C<gsl_deriv_backward>
88 =item * C<gsl_deriv_forward>
90 =back
92 For more informations on the functions, we refer you to the GSL offcial
93 documentation: L<http://www.gnu.org/software/gsl/manual/html_node/>
95 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
98 =head1 AUTHORS
100 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
102 =head1 COPYRIGHT AND LICENSE
104 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
106 This program is free software; you can redistribute it and/or modify it
107 under the same terms as Perl itself.
109 =cut