1LINALG(3) User Contributed Perl Documentation LINALG(3)
2
3
4
6 PDL::GSL::LINALG - PDL interface to linear algebra routines in GSL
7
9 use PDL::LiteF;
10 use PDL::MatrixOps; # for 'x'
11 use PDL::GSL::LINALG;
12 my $A = pdl [
13 [0.18, 0.60, 0.57, 0.96],
14 [0.41, 0.24, 0.99, 0.58],
15 [0.14, 0.30, 0.97, 0.66],
16 [0.51, 0.13, 0.19, 0.85],
17 ];
18 my $B = sequence(2,4); # column vectors
19 LU_decomp(my $lu=$A->copy, my $p=null, my $signum=null);
20 # transpose so first dim means is vector, higher dims thread
21 LU_solve($lu, $p, $B->transpose, my $x=null);
22 $x = $x->inplace->transpose; # now can be matrix-multiplied
23
25 This is an interface to the linear algebra package present in the GNU
26 Scientific Library. Functions are named as in GSL, but with the initial
27 "gsl_linalg_" removed. They are provided in both real and complex
28 double precision.
29
30 Currently only LU decomposition interfaces here. Pull requests welcome!
31
33 LU_decomp
34 Signature: ([io,phys]A(n,m); indx [o,phys]ipiv(p); int [o,phys]signum())
35
36 LU decomposition of the given (real or complex) matrix.
37
38 LU_decomp ignores the bad-value flag of the input ndarrays. It will
39 set the bad-value flag of all output ndarrays if the flag is set for
40 any of the input ndarrays.
41
42 LU_solve
43 Signature: ([phys]LU(n,m); indx [phys]ipiv(p); [phys]B(n); [o,phys]x(n))
44
45 Solve "A x = B" using the LU and permutation from "LU_decomp", real or
46 complex.
47
48 LU_solve ignores the bad-value flag of the input ndarrays. It will set
49 the bad-value flag of all output ndarrays if the flag is set for any of
50 the input ndarrays.
51
52 LU_det
53 Signature: ([phys]LU(n,m); int [phys]signum(); [o]det())
54
55 Find the determinant from the LU decomp.
56
57 LU_det ignores the bad-value flag of the input ndarrays. It will set
58 the bad-value flag of all output ndarrays if the flag is set for any of
59 the input ndarrays.
60
61 solve_tridiag
62 Signature: ([phys]diag(n); [phys]superdiag(n); [phys]subdiag(n); [phys]B(n); [o,phys]x(n))
63
64 Solve "A x = B" where A is a tridiagonal system. Real only, because GSL
65 does not have a complex function.
66
67 solve_tridiag ignores the bad-value flag of the input ndarrays. It
68 will set the bad-value flag of all output ndarrays if the flag is set
69 for any of the input ndarrays.
70
72 PDL
73
74 The GSL documentation for linear algebra is online at
75 <https://www.gnu.org/software/gsl/doc/html/linalg.html>
76
77
78
79perl v5.34.0 2021-08-16 LINALG(3)