5 %apply float
*OUTPUT { float
*result
};
6 %apply double
*OUTPUT { double
*result
};
9 #include
"gsl/gsl_blas.h"
10 #include
"gsl/gsl_blas_types.h"
13 %include
"gsl/gsl_blas.h"
14 %include
"gsl/gsl_blas_types.h"
18 @EXPORT_OK_level1
= qw
/
19 gsl_blas_sdsdot gsl_blas_dsdot gsl_blas_sdot gsl_blas_ddot
20 gsl_blas_cdotu gsl_blas_cdotc gsl_blas_zdotu gsl_blas_zdotc
21 gsl_blas_snrm2 gsl_blas_sasum gsl_blas_dnrm2 gsl_blas_dasum
22 gsl_blas_scnrm2 gsl_blas_scasum gsl_blas_dznrm2 gsl_blas_dzasum
23 gsl_blas_isamax gsl_blas_idamax gsl_blas_icamax gsl_blas_izamax
24 gsl_blas_sswap gsl_blas_scopy gsl_blas_saxpy gsl_blas_dswap
25 gsl_blas_dcopy gsl_blas_daxpy gsl_blas_cswap gsl_blas_ccopy
26 gsl_blas_caxpy gsl_blas_zswap gsl_blas_zcopy gsl_blas_zaxpy
27 gsl_blas_srotg gsl_blas_srotmg gsl_blas_srot gsl_blas_srotm
28 gsl_blas_drotg gsl_blas_drotmg gsl_blas_drot gsl_blas_drotm
29 gsl_blas_sscal gsl_blas_dscal gsl_blas_cscal gsl_blas_zscal
30 gsl_blas_csscal gsl_blas_zdscal
32 @EXPORT_OK_level2
= qw
/
33 gsl_blas_sgemv gsl_blas_strmv
34 gsl_blas_strsv gsl_blas_dgemv gsl_blas_dtrmv gsl_blas_dtrsv
35 gsl_blas_cgemv gsl_blas_ctrmv gsl_blas_ctrsv gsl_blas_zgemv
36 gsl_blas_ztrmv gsl_blas_ztrsv gsl_blas_ssymv gsl_blas_sger
37 gsl_blas_ssyr gsl_blas_ssyr2 gsl_blas_dsymv gsl_blas_dger
38 gsl_blas_dsyr gsl_blas_dsyr2 gsl_blas_chemv gsl_blas_cgeru
39 gsl_blas_cgerc gsl_blas_cher gsl_blas_cher2 gsl_blas_zhemv
40 gsl_blas_zgeru gsl_blas_zgerc gsl_blas_zher gsl_blas_zher2
43 @EXPORT_OK_level3
= qw
/
44 gsl_blas_sgemm gsl_blas_ssymm gsl_blas_ssyrk gsl_blas_ssyr2k
45 gsl_blas_strmm gsl_blas_strsm gsl_blas_dgemm gsl_blas_dsymm
46 gsl_blas_dsyrk gsl_blas_dsyr2k gsl_blas_dtrmm gsl_blas_dtrsm
47 gsl_blas_cgemm gsl_blas_csymm gsl_blas_csyrk gsl_blas_csyr2k
48 gsl_blas_ctrmm gsl_blas_ctrsm gsl_blas_zgemm gsl_blas_zsymm
49 gsl_blas_zsyrk gsl_blas_zsyr2k gsl_blas_ztrmm gsl_blas_ztrsm
50 gsl_blas_chemm gsl_blas_cherk gsl_blas_cher2k gsl_blas_zhemm
51 gsl_blas_zherk gsl_blas_zher2k
53 @EXPORT_OK
= (@EXPORT_OK_level1
, @EXPORT_OK_level2
, @EXPORT_OK_level3
);
55 all
=> [ @EXPORT_OK
],
56 level1
=> [ @EXPORT_OK_level1
],
57 level2
=> [ @EXPORT_OK_level2
],
58 level3
=> [ @EXPORT_OK_level3
],
64 Math
::GSL
::BLAS
- Basic Linear Algebra Subprograms
68 use Math
::GSL
::QRNG qw
/:all
/;
72 The functions of this module are divised into
3 levels
:
74 =head2 Level
1 - Vector operations
78 =item C
<gsl_blas_sdsdot
>
80 =item C
<gsl_blas_dsdot
>
82 =item C
<gsl_blas_sdot
>
84 =item C
<gsl_blas_ddot
($x
, $y
)> - This function computes the scalar product x^T y for the vectors $x and $y. The function returns two values
, the first is
0 if the operation suceeded
, 1 otherwise and the second value is the result of the computation.
86 =item C
<gsl_blas_cdotu
>
88 =item C
<gsl_blas_cdotc
>
90 =item C
<gsl_blas_zdotu
($x
, $y
, $dotu
)> - This function computes the complex scalar product x^T y for the complex vectors $x and $y
, returning the result in the complex number $dotu. The function returns
0 if the operation suceeded
, 1 otherwise.
92 =item C
<gsl_blas_zdotc
($x
, $y
, $dotc
)> - This function computes the complex conjugate scalar product x^H y for the complex vectors $x and $y
, returning the result in the complex number $dotc. The function returns
0 if the operation suceeded
, 1 otherwise.
94 =item C
<gsl_blas_snrm2
>
95 =item C
<gsl_blas_sasum
>
97 =item C
<gsl_blas_dnrm2
($x
)> - This function computes the Euclidean norm ||x||_2
= \sqrt
{\sum x_i^
2} of the vector $x.
99 =item C
<gsl_blas_dasum
($x
)> - This function computes the absolute sum \sum |x_i| of the elements of the vector $x.
101 =item C
<gsl_blas_scnrm2
>
103 =item C
<gsl_blas_scasum
>
105 =item C
<gsl_blas_dznrm2
($x
)> - This function computes the Euclidean norm of the complex vector $x
, ||x||_2
= \sqrt
{\sum
(\Re
(x_i
)^
2 + \Im
(x_i
)^
2)}.
107 =item C
<gsl_blas_dzasum
($x
)> - This function computes the sum of the magnitudes of the real and imaginary parts of the complex vector $x
, \sum |\Re
(x_i
)|
+ |\Im
(x_i
)|.
109 =item C
<gsl_blas_isamax
>
111 =item C
<gsl_blas_idamax
>
113 =item C
<gsl_blas_icamax
>
115 =item C
<gsl_blas_izamax
>
117 =item C
<gsl_blas_sswap
>
119 =item C
<gsl_blas_scopy
>
121 =item C
<gsl_blas_saxpy
>
123 =item C
<gsl_blas_dswap
($x
, $y
)> - This function exchanges the elements of the vectors $x and $y. The function returns
0 if the operation suceeded
, 1 otherwise.
125 =item C
<gsl_blas_dcopy
($x
, $y
)> - This function copies the elements of the vector $x into the vector $y. The function returns
0 if the operation suceeded
, 1 otherwise.
127 =item C
<gsl_blas_daxpy
($alpha
, $x
, $y
)> - These functions compute the sum $y
= $alpha
* $x
+ $y for the vectors $x and $y.
129 =item C
<gsl_blas_cswap
>
131 =item C
<gsl_blas_ccopy
>
133 =item C
<gsl_blas_caxpy
>
135 =item C
<gsl_blas_zswap
>
137 =item C
<gsl_blas_zcopy
>
139 =item C
<gsl_blas_zaxpy
>
141 =item C
<gsl_blas_srotg
>
143 =item C
<gsl_blas_srotmg
>
145 =item C
<gsl_blas_srot
>
147 =item C
<gsl_blas_srotm
>
149 =item C
<gsl_blas_drotg
>
151 =item C
<gsl_blas_drotmg
>
153 =item C
<gsl_blas_drot
($x
, $y
, $c
, $s
)> - This function applies a Givens rotation
(x'
, y'
) = (c x
+ s y
, -s x
+ c y
) to the vectors $x
, $y.
155 =item C
<gsl_blas_drotm
>
157 =item C
<gsl_blas_sscal
>
159 =item C
<gsl_blas_dscal
($alpha
, $x
)> - This function rescales the vector $x by the multiplicative factor $alpha.
161 =item C
<gsl_blas_cscal
>
163 =item C
<gsl_blas_zscal
>
165 =item C
<gsl_blas_csscal
>
167 =item C
<gsl_blas_zdscal
>
171 =head2 Level
2 - Matrix-vector operations
175 =item C
<gsl_blas_sgemv
>
177 =item C
<gsl_blas_strmv
>
179 =item C
<gsl_blas_strsv
>
181 =item C
<gsl_blas_dgemv
($TransA
, $alpha
, $A
, $x
, $beta
, $y
)> - This function computes the matrix-vector product and sum y
= \alpha op
(A
) x
+ \beta y
, where op
(A
) = A
, A^T
, A^H for $TransA
= $CblasNoTrans
, $CblasTrans
, $CblasConjTrans
(constant values coming from the CBLAS module
). $A is a matrix and $x and $y are vectors.
183 =item C
<gsl_blas_dtrmv
($Uplo
, $TransA
, $Diag
, $A
, $x
)> - This function computes the matrix-vector product x
= op
(A
) x for the triangular matrix $A
, where op
(A
) = A
, A^T
, A^H for $TransA
= $CblasNoTrans
, $CblasTrans
, $CblasConjTrans
(constant values coming from the CBLAS module
). When $Uplo is $CblasUpper then the upper triangle of $A is used
, and when $Uplo is $CblasLower then the lower triangle of $A is used. If $Diag is $CblasNonUnit then the diagonal of the matrix is used
, but if $Diag is $CblasUnit then the diagonal elements of the matrix $A are taken as unity and are not referenced.
185 =item C
<gsl_blas_dtrsv
>
187 =item C
<gsl_blas_cgemv
>
189 =item C
<gsl_blas_ctrmv
>
191 =item C
<gsl_blas_ctrsv
>
193 =item C
<gsl_blas_zgemv
>
195 =item C
<gsl_blas_ztrmv
>
197 =item C
<gsl_blas_ztrsv
>
199 =item C
<gsl_blas_ssymv
>
201 =item C
<gsl_blas_sger
>
203 =item C
<gsl_blas_ssyr
>
205 =item C
<gsl_blas_ssyr2
>
207 =item C
<gsl_blas_dsymv
>
209 =item C
<gsl_blas_dger
($alpha
, $x
, $y
, $A
)> - This function computes the rank-1 update A
= alpha x y^T
+ A of the matrix $A. $x and $y are vectors. The function returns
0 if the operation suceeded
, 1 otherwise.
211 =item C
<gsl_blas_dsyr
>
213 =item C
<gsl_blas_dsyr2
>
215 =item C
<gsl_blas_chemv
>
217 =item C
<gsl_blas_cgeru
>
219 =item C
<gsl_blas_cgerc
>
221 =item C
<gsl_blas_cher
>
223 =item C
<gsl_blas_cher2
>
225 =item C
<gsl_blas_zhemv
>
227 =item C
<gsl_blas_zgeru
($alpha
, $x
, $y
, $A
)> - This function computes the rank-1 update A
= alpha x y^T
+ A of the complex matrix $A. $alpha is a complex number and $x and $y are complex vectors. The function returns
0 if the operation suceeded
, 1 otherwise.
229 =item C
<gsl_blas_zgerc
>
231 =item C
<gsl_blas_zher
>
233 =item C
<gsl_blas_zher2
>
237 =head2 Level
3 - Matrix-matrix operations
241 =item C
<gsl_blas_sgemm
>
243 =item C
<gsl_blas_ssymm
>
245 =item C
<gsl_blas_ssyrk
>
247 =item C
<gsl_blas_ssyr2k
>
249 =item C
<gsl_blas_strmm
>
251 =item C
<gsl_blas_strsm
>
253 =item C
<gsl_blas_dgemm
>
255 =item C
<gsl_blas_dsymm
>
257 =item C
<gsl_blas_dsyrk
>
259 =item C
<gsl_blas_dsyr2k
>
261 =item C
<gsl_blas_dtrmm
>
263 =item C
<gsl_blas_dtrsm
>
265 =item C
<gsl_blas_cgemm
>
267 =item C
<gsl_blas_csymm
>
269 =item C
<gsl_blas_csyrk
>
271 =item C
<gsl_blas_csyr2k
>
273 =item C
<gsl_blas_ctrmm
>
275 =item C
<gsl_blas_ctrsm
>
277 =item C
<gsl_blas_zgemm
>
279 =item C
<gsl_blas_zsymm
>
281 =item C
<gsl_blas_zsyrk
>
283 =item C
<gsl_blas_zsyr2k
>
285 =item C
<gsl_blas_ztrmm
>
287 =item C
<gsl_blas_ztrsm
>
289 =item C
<gsl_blas_chemm
>
291 =item C
<gsl_blas_cherk
>
293 =item C
<gsl_blas_cher2k
>
295 =item C
<gsl_blas_zhemm
>
297 =item C
<gsl_blas_zherk
>
299 =item C
<gsl_blas_zher2k
>
303 You have to add the functions you want to use inside the qw
/put_funtion_here
/.
304 You can also write use Math
::GSL
::PowInt qw
/:all
/ to use all avaible functions of the module.
305 Other tags are also avaible
, here is a complete list of all tags for this module
:
317 For more informations on the functions
, we refer you to the GSL offcial documentation
: L
<http
://www.gnu.org
/software
/gsl
/manual
/html_node
/>
319 Tip
: search on google
: site
:http
://www.gnu.org
/software
/gsl
/manual
/html_node
/ name_of_the_function_you_want
326 Jonathan Leto
<jonathan@leto.net
> and Thierry Moisan
<thierry.moisan@gmail.com
>
328 =head1 COPYRIGHT
AND LICENSE
330 Copyright
(C
) 2008 Jonathan Leto and Thierry Moisan
332 This program is free software
; you can redistribute it and
/or modify it
333 under the same terms as Perl itself.