1Matrix(3)             User Contributed Perl Documentation            Matrix(3)
2
3
4

NAME

6       PDL::Matrix -- a convenience matrix class for column-major access
7

VERSION

9       This document refers to version PDL::Matrix 0.5 of PDL::Matrix
10

SYNOPSIS

12         use PDL::Matrix;
13
14         $m = mpdl [[1,2,3],[4,5,6]];
15         $m = PDL::Matrix->pdl([[1,2,3],[4,5,6]]);
16         $m = msequence(4,3);
17         @dimsa = $a->mdims; # 'dims' is not overloaded
18
19         $v = vpdl [0,1,2,3]
20         $v = vzeroes(4);
21

DESCRIPTION

23       Overview
24
25       This package tries to help people who want to use PDL for 2D matrix
26       computation with lots of indexing involved. It provides a PDL subclass
27       so one- and two-dimensional piddles that are used as vectors resp and
28       matrices can be typed in using traditional matrix convention.
29
30       If you want to know more about matrix operation support in PDL, you
31       want to read PDL::MatrixOps or PDL::Slatec.
32
33       The original pdl class refers to the first index as the first row, the
34       second index as the first column of a matrix. Consider
35
36         print $B = sequence(3,2)
37         [
38          [0 1 2]
39          [3 4 5]
40         ]
41
42       which gives a 2x3 matrix in terms of the matrix convention, but the
43       constructor used (3,2). This might get more confusing when using slices
44       like sequence(3,2)->slice("1:2,(0)") : with traditional matrix conven‐
45       tion one would expect [2 4] instead of [1 2].
46
47       This subclass PDL::Matrix overloads the constructors and indexing func‐
48       tions of pdls so that they are compatible with the usual matrix conven‐
49       tion, where the first dimension refers to the row of a matrix. So now,
50       the above example would be written as
51
52         print $B = PDL::Matrix->sequence(3,2) # or $B = msequence(3,2)
53         [
54          [0 1]
55          [2 3]
56          [4 5]
57         ]
58
59       Routines like eigens or inv can be used without any changes.
60
61       Furthermore one can construct and use vectors as n x 1 matrices without
62       mentioning the second index '1'.
63
64       Implementation
65
66       "PDL::Matrix" works by overloading a number of PDL constructors and
67       methods such that first and second args (corresponding to first and
68       second dims of corresponding matrices) are effectively swapped.  It is
69       not yet clear if PDL::Matrix achieves a consistent column-major look-
70       and-feel in this way.
71

NOTES

73       As of version 0.5 (rewrite by CED) the matrices are stored in the usual
74       way, just constructed and stringified differently.  That way indexing
75       and everything else works the way you think it should.
76

FUNCTIONS

78       mpdl, PDL::Matrix::pdl
79
80       constructs an object of class PDL::Matrix which is a piddle child
81       class.
82
83           $m = mpdl [[1,2,3],[4,5,6]];
84           $m = PDL::Matrix->pdl([[1,2,3],[4,5,6]]);
85
86       mzeroes, mones, msequence
87
88       constructs a PDL::Matrix object similar to the piddle constructors
89       zeroes, ones, sequence.
90
91       vpdl
92
93       constructs an object of class PDL::Matrix which is of matrix dimensions
94       (n x 1)
95
96           print $v = vpdl [0,1];
97           [
98            [0]
99            [1]
100           ]
101
102       vzeroes, vones, vsequence
103
104       constructs a PDL::Matrix object with matrix dimensions (n x 1), there‐
105       fore only the first scalar argument is used.
106
107           print $v = vsequence(2);
108           [
109            [0]
110            [1]
111           ]
112
113       kroneckerproduct
114
115       returns kroneckerproduct of two matrices. This is not efficiently
116       implemented.
117
118       det_general
119
120       returns a generalized determinant of a matrix. If the matrix is not
121       regular, one can specify the rank of the matrix and the corresponding
122       subdeterminant is returned. This is implemented using the "eigens"
123       function.
124
125       trace
126
127       returns the trace of a matrix (sum of diagonals)
128
129       vcrossp, PDL::Matrix::crossp
130
131       similar to PDL::crossp, however reflecting PDL::Matrix notations
132

BUGS AND PROBLEMS

134       Because we change the way piddles are constructed, not all pdl opera‐
135       tors may be applied to piddle-matrices. The inner product is not rede‐
136       fined. We might have missed some functions/methods. Internal consis‐
137       tency of our approach needs yet to be established.
138
139       Because PDL::Matrix changes the way slicing behaves, it breaks many
140       operators, notably those in MatrixOps.
141

TODO

143       check all PDL functions, benchmarks, optimization, lots of other things
144       ...
145

AUTHOR(S)

147       Stephan Heuel (stephan@heuel.org), Christian Soeller (c.soeller@auck‐
148       land.ac.nz).
149
151       All rights reserved. There is no warranty. You are allowed to redis‐
152       tribute this software / documentation under certain conditions. For
153       details, see the file COPYING in the PDL distribution. If this file is
154       separated from the PDL distribution, the copyright notice should be
155       included in the file.
156
157
158
159perl v5.8.8                       2004-09-07                         Matrix(3)
Impressum