Removing the Block subsystem since there's no need for a Perl interface for it
[Math-GSL.git] / Sum.i
blob7342a2cafb1d7bda3b6d4bdc05f3e5e2b13aea46
1 %module "Math::GSL::Sum"
2 %include "gsl_typemaps.i"
4 %apply double *OUTPUT { double * sum_accel, double * abserr, double * abserr_trunc };
6 %{
7 #include "gsl/gsl_sum.h"
8 %}
10 %include "gsl/gsl_sum.h"
12 %perlcode %{
13 @EXPORT_OK = qw/
14 gsl_sum_levin_u_alloc
15 gsl_sum_levin_u_free
16 gsl_sum_levin_u_accel
17 gsl_sum_levin_u_minmax
18 gsl_sum_levin_u_step
19 gsl_sum_levin_utrunc_alloc
20 gsl_sum_levin_utrunc_free
21 gsl_sum_levin_utrunc_accel
22 gsl_sum_levin_utrunc_minmax
23 gsl_sum_levin_utrunc_step
25 %EXPORT_TAGS = ( all => \@EXPORT_OK );
27 __END__
29 =head1 NAME
31 Math::GSL::Sum - Functions to accelerate the convergence of a series using the Levin u-transform.
33 =head1 SYNOPSIS
35 use Math::GSL::Sum qw/:all/;
37 my $w = gsl_sum_levin_u_alloc(5);
38 $values = [8,2,3,4,6];
39 my ($status, $sum_accel, $abserr) = gsl_sum_levin_u_accel($values, 5, $w);
40 gsl_sum_levin_u_free($w);
42 my $w2 = gsl_sum_levin_utrunc_alloc(5);
43 my ($status2, $sum_accel2, $abserr_trunc) = gsl_sum_levin_utrunc_accel($values, 5, $w2);
44 gsl_sum_levin_utrunc_free($w);
46 =head1 DESCRIPTION
48 Here is a list of all the functions included in this module :
50 =over
52 =item * gsl_sum_levin_u_alloc($n) - This function allocates a workspace for a Levin u-transform of $n terms.
54 =item * gsl_sum_levin_u_free($w) - This function frees the memory associated with the workspace $w.
56 =item * gsl_sum_levin_u_accel($array, $array_size, $w) - This function takes the terms of a series in the array reference $array of size $array_size and computes the extrapolated limit of the series using a Levin u-transform. Additional working space must be provided in $w. The function returns multiple values in this order : 0 if the operation succeeded, 1 otherwise, the extrapolated sum and an estimate of the absolute error. The actual term-by-term sum is returned in $w->{sum_plain}. The algorithm calculates the truncation error (the difference between two successive extrapolations) and round-off error (propagated from the individual terms) to choose an optimal number of terms for the extrapolation. All the terms of the series passed in through array should be non-zero.
58 =item * gsl_sum_levin_u_minmax
60 =item * gsl_sum_levin_u_step
62 =item * gsl_sum_levin_utrunc_alloc($n) - This function allocates a workspace for a Levin u-transform of $n terms, without error estimation.
64 =item * gsl_sum_levin_utrunc_free($w) - This function frees the memory associated with the workspace $w.
66 =item * gsl_sum_levin_utrunc_accel($array, $array_size, $w) - This function takes the terms of a series in the array reference $array of size $array_size and computes the extrapolated limit of the series using a Levin u-transform. Additional working space must be provided in $w. The function returns multiple values in this order : 0 if the operation succeeded, 1 otherwise, the extrapolated sum and an estimate of the error. The actual term-by-term sum is returned in $w->{sum_plain}. The algorithm terminates when the difference between two successive extrapolations reaches a minimum or is sufficiently small. To improve the reliability of the algorithm the extrapolated values are replaced by moving averages when calculating the truncation error, smoothing out any fluctuations.
68 =item * gsl_sum_levin_utrunc_minmax
70 =item * gsl_sum_levin_utrunc_step
72 =back
74 =head1 AUTHORS
76 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
78 =head1 COPYRIGHT AND LICENSE
80 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
82 This program is free software; you can redistribute it and/or modify it
83 under the same terms as Perl itself.
85 =cut