3 #include
"/usr/local/include/gsl/gsl_complex.h"
4 #include
"/usr/local/include/gsl/gsl_complex_math.h"
7 %include
"/usr/local/include/gsl/gsl_complex.h"
8 %include
"/usr/local/include/gsl/gsl_complex_math.h"
12 %array_functions
(double
, doubleArray
);
17 gsl_complex_arg gsl_complex_abs gsl_complex_rect gsl_complex_polar doubleArray_getitem
18 gsl_complex_rect gsl_complex_polar gsl_complex_arg gsl_complex_abs gsl_complex_abs2
19 gsl_complex_logabs gsl_complex_add gsl_complex_sub gsl_complex_mul gsl_complex_div
20 gsl_complex_add_real gsl_complex_sub_real gsl_complex_mul_real gsl_complex_div_real
21 gsl_complex_add_imag gsl_complex_sub_imag gsl_complex_mul_imag gsl_complex_div_imag
22 gsl_complex_conjugate gsl_complex_inverse gsl_complex_negative gsl_complex_sqrt
23 gsl_complex_sqrt_real gsl_complex_pow gsl_complex_pow_real gsl_complex_exp
24 gsl_complex_log gsl_complex_log10 gsl_complex_log_b gsl_complex_sin
25 gsl_complex_cos gsl_complex_sec gsl_complex_csc gsl_complex_tan
26 gsl_complex_cot gsl_complex_arcsin gsl_complex_arcsin_real gsl_complex_arccos
27 gsl_complex_arccos_real gsl_complex_arcsec gsl_complex_arcsec_real gsl_complex_arccsc
28 gsl_complex_arccsc_real gsl_complex_arctan gsl_complex_arccot gsl_complex_sinh
29 gsl_complex_cosh gsl_complex_sech gsl_complex_csch gsl_complex_tanh
30 gsl_complex_coth gsl_complex_arcsinh gsl_complex_arccosh gsl_complex_arccosh_real
31 gsl_complex_arcsech gsl_complex_arccsch gsl_complex_arctanh gsl_complex_arctanh_real
32 gsl_complex_arccoth new_doubleArray delete_doubleArray doubleArray_setitem
33 gsl_real gsl_imag gsl_parts
34 gsl_complex_eq gsl_set_real gsl_set_imag gsl_set_complex
35 $GSL_COMPLEX_ONE $GSL_COMPLEX_ZERO $GSL_COMPLEX_NEGONE
38 # gsl_set_complex gsl_set_complex_packed
39 our
($GSL_COMPLEX_ONE
, $GSL_COMPLEX_ZERO
, $GSL_COMPLEX_NEGONE
) = map
{ gsl_complex_rect
($_
, 0) } qw
(1 0 -1);
42 %EXPORT_TAGS
= ( all
=> [ @EXPORT_OK
] );
44 ### wrapper interface ###
46 my
($class
, @values
) = @_
;
48 $this-
>{_complex
} = gsl_complex_rect
($values
[0], $values
[1]);
53 gsl_real
($self-
>{_complex
}->{dat
});
58 gsl_imag
($self-
>{_complex
}->{dat
});
63 gsl_parts
($self-
>{_complex
}->{dat
});
66 ### end wrapper interface ###
68 ### some important macros that are in gsl_complex.h
71 gsl_real
($z
) == gsl_real
($w
) && gsl_imag($z) == gsl_imag($w) ? 1 : 0;
76 doubleArray_setitem
($z-
>{dat
}, 0, $r
);
81 doubleArray_setitem
($z-
>{dat
}, 1, $i
);
86 return doubleArray_getitem
($z-
>{dat
}, 0 );
91 return doubleArray_getitem
($z-
>{dat
}, 1 );
96 return
(gsl_real
($z
), gsl_imag
($z
));
100 my
($z
, $r
, $i
) = @_
;
101 gsl_set_real
($z
, $r
);
102 gsl_set_imag
($z
, $i
);
110 Functions concerning complex numbers.
114 use Math
::GSL
::Complex qw
/:all
/;
118 Here is a list of all the functions included in this module
:
119 gsl_complex_arg gsl_complex_abs gsl_complex_rect gsl_complex_polar doubleArray_getitem
120 gsl_complex_rect gsl_complex_polar gsl_complex_arg gsl_complex_abs gsl_complex_abs2
121 gsl_complex_logabs gsl_complex_add gsl_complex_sub gsl_complex_mul gsl_complex_div
122 gsl_complex_add_real gsl_complex_sub_real gsl_complex_mul_real gsl_complex_div_real
123 gsl_complex_add_imag gsl_complex_sub_imag gsl_complex_mul_imag gsl_complex_div_imag
124 gsl_complex_conjugate gsl_complex_inverse gsl_complex_negative gsl_complex_sqrt
125 gsl_complex_sqrt_real gsl_complex_pow gsl_complex_pow_real gsl_complex_exp
126 gsl_complex_log gsl_complex_log10 gsl_complex_log_b gsl_complex_sin
127 gsl_complex_cos gsl_complex_sec gsl_complex_csc gsl_complex_tan
128 gsl_complex_cot gsl_complex_arcsin gsl_complex_arcsin_real gsl_complex_arccos
129 gsl_complex_arccos_real gsl_complex_arcsec gsl_complex_arcsec_real gsl_complex_arccsc
130 gsl_complex_arccsc_real gsl_complex_arctan gsl_complex_arccot gsl_complex_sinh
131 gsl_complex_cosh gsl_complex_sech gsl_complex_csch gsl_complex_tanh
132 gsl_complex_coth gsl_complex_arcsinh gsl_complex_arccosh gsl_complex_arccosh_real
133 gsl_complex_arcsech gsl_complex_arccsch gsl_complex_arctanh gsl_complex_arctanh_real
134 gsl_complex_arccoth new_doubleArray delete_doubleArray doubleArray_setitem
135 gsl_real gsl_imag gsl_parts
136 gsl_complex_eq gsl_set_real gsl_set_imag gsl_set_complex
138 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.
140 For more informations on the functions
, we refer you to the GSL offcial documentation
: http
://www.gnu.org
/software
/gsl
/manual
/html_node
/
141 Tip
: search on google
: site
:http
://www.gnu.org
/software
/gsl
/manual
/html_node
/ name_of_the_function_you_want
145 use Math
::GSL
::Complex qw
/:all
/;
146 $x
= gsl_complex_rect
(6,4);
147 $z
= gsl_complex_conjugate
($x
);
148 print
"Real = " gsl_real
($z
) .
"\n Imag = " . gsl_imag
($z
);
151 use Math
::GSL
::Complex qw
/:all
/;
152 $x
= gsl_complex_rect
(5,3);
153 $z
= gsl_complex_mul_real
($x
, 2);
154 print
"Real = " gsl_real
($z
) .
"\n Imag = " . gsl_imag
($z
);
158 Jonathan Leto
<jaleto@gmail.com
> and Thierry Moisan
<thierry.moisan@gmail.com
>
160 =head1 COPYRIGHT
AND LICENSE
162 Copyright
(C
) 2008 Jonathan Leto and Thierry Moisan
164 This program is free software
; you can redistribute it and
/or modify it
165 under the same terms as Perl itself.