Adding tests to the complex subsystem.
[Math-GSL.git] / Complex.i
blobb1e56751e2a7ab3f8af1c603ba51d1d2d2c3581b
1 %module Complex
2 %{
3 #include "/usr/local/include/gsl/gsl_complex.h"
4 #include "/usr/local/include/gsl/gsl_complex_math.h"
5 %}
7 %include "/usr/local/include/gsl/gsl_complex.h"
8 %include "/usr/local/include/gsl/gsl_complex_math.h"
11 %include "carrays.i"
12 %array_functions(double, doubleArray);
14 /* r= real+i*imag */
15 //gsl_complex gsl_complex_rect (double x, double y);
17 /* r= r e^(i theta) */
18 //gsl_complex gsl_complex_polar (double r, double theta);
20 %perlcode %{
22 @EXPORT_OK = qw(
23 gsl_complex_arg gsl_complex_abs gsl_complex_rect gsl_complex_polar doubleArray_getitem
24 gsl_complex_rect gsl_complex_polar gsl_complex_arg gsl_complex_abs gsl_complex_abs2
25 gsl_complex_logabs gsl_complex_add gsl_complex_sub gsl_complex_mul gsl_complex_div
26 gsl_complex_add_real gsl_complex_sub_real gsl_complex_mul_real gsl_complex_div_real
27 gsl_complex_add_imag gsl_complex_sub_imag gsl_complex_mul_imag gsl_complex_div_imag
28 gsl_complex_conjugate gsl_complex_inverse gsl_complex_negative gsl_complex_sqrt
29 gsl_complex_sqrt_real gsl_complex_pow gsl_complex_pow_real gsl_complex_exp
30 gsl_complex_log gsl_complex_log10 gsl_complex_log_b gsl_complex_sin
31 gsl_complex_cos gsl_complex_sec gsl_complex_csc gsl_complex_tan
32 gsl_complex_cot gsl_complex_arcsin gsl_complex_arcsin_real gsl_complex_arccos
33 gsl_complex_arccos_real gsl_complex_arcsec gsl_complex_arcsec_real gsl_complex_arccsc
34 gsl_complex_arccsc_real gsl_complex_arctan gsl_complex_arccot gsl_complex_sinh
35 gsl_complex_cosh gsl_complex_sech gsl_complex_csch gsl_complex_tanh
36 gsl_complex_coth gsl_complex_arcsinh gsl_complex_arccosh gsl_complex_arccosh_real
37 gsl_complex_arcsech gsl_complex_arccsch gsl_complex_arctanh gsl_complex_arctanh_real
38 gsl_complex_arccoth new_doubleArray delete_doubleArray doubleArray_setitem
41 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
43 sub new {
44 my ($class, @values) = @_;
45 my $this = {};
46 $this->{_complex} = gsl_complex_rect($values[0], $values[1]);
47 bless $this, $class;
49 sub real {
50 my ($self) = @_;
51 return doubleArray_getitem($self->{_complex}->{dat}, 0 );
54 sub imag {
55 my ($self) = @_;
56 return doubleArray_getitem($self->{_complex}->{dat}, 1 );
59 __END__
61 =head1 NAME
63 Math::GSL::Complex
64 Functions concerning complex numbers.
66 =head1 SYPNOPSIS
68 use Math::GSL::Complex qw/:all/;
70 =head1 DESCRIPTION
72 Here is a list of all the functions included in this module :
73 gsl_complex_arg gsl_complex_abs gsl_complex_rect gsl_complex_polar doubleArray_getitem
74 gsl_complex_rect gsl_complex_polar gsl_complex_arg gsl_complex_abs gsl_complex_abs2
75 gsl_complex_logabs gsl_complex_add gsl_complex_sub gsl_complex_mul gsl_complex_div
76 gsl_complex_add_real gsl_complex_sub_real gsl_complex_mul_real gsl_complex_div_real
77 gsl_complex_add_imag gsl_complex_sub_imag gsl_complex_mul_imag gsl_complex_div_imag
78 gsl_complex_conjugate gsl_complex_inverse gsl_complex_negative gsl_complex_sqrt
79 gsl_complex_sqrt_real gsl_complex_pow gsl_complex_pow_real gsl_complex_exp
80 gsl_complex_log gsl_complex_log10 gsl_complex_log_b gsl_complex_sin
81 gsl_complex_cos gsl_complex_sec gsl_complex_csc gsl_complex_tan
82 gsl_complex_cot gsl_complex_arcsin gsl_complex_arcsin_real gsl_complex_arccos
83 gsl_complex_arccos_real gsl_complex_arcsec gsl_complex_arcsec_real gsl_complex_arccsc
84 gsl_complex_arccsc_real gsl_complex_arctan gsl_complex_arccot gsl_complex_sinh
85 gsl_complex_cosh gsl_complex_sech gsl_complex_csch gsl_complex_tanh
86 gsl_complex_coth gsl_complex_arcsinh gsl_complex_arccosh gsl_complex_arccosh_real
87 gsl_complex_arcsech gsl_complex_arccsch gsl_complex_arctanh gsl_complex_arctanh_real
88 gsl_complex_arccoth new_doubleArray delete_doubleArray doubleArray_setitem
90 You have to add the functions you want to use inside the qw /put_funtion_here / with spaces between each function. You can also write use Math::GSL::Complex qw/:all/ to use all avaible functions of the module.
92 For more informations on the functions, we refer you to the GSL offcial documentation: http://www.gnu.org/software/gsl/manual/html_node/
93 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
95 =head1 EXAMPLES
98 =head1 AUTHOR
100 Jonathan Leto <jaleto@gmail.com> 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