PDL::Matrix(3pm)
β¨ NAME β¨
okay bestie, welcome to PDL::Matrix(3pm) β it's part of the User Contributed Perl Documentation and it's literally PDL::Matrix -- a convenience matrix class for column-major access πβ¨
πΈ VERSION πΈ
this doc is referring to version PDL::Matrix 0.5 of PDL::Matrix π
no cap.
π¦ SYNOPSIS π¦
here's the whole vibe, bestie:
use PDL::Matrix;
$m = mpdl [[1,2,3],[4,5,6]];
$m = PDL::Matrix->pdl([[1,2,3],[4,5,6]]);
$m = msequence(4,3);
@dimsa = $x->mdims; # 'dims' is not overloaded
$v = vpdl [0,1,2,3]
$v = vzeroes(4);
π DESCRIPTION π
π Overview π
okay so this package is trying to help people who wanna use PDL for 2D matrix computation with lots of indexing involved π§π It provides a PDL subclass so one- and two-dimensional ndarrays that are used as vectors resp and matrices can be typed in using traditional matrix convention. periodt.
if you wanna know more about matrix operation support in PDL, you want to read PDL::MatrixOps or PDL::LinearAlgebra π
the original pdl class refers to the first index as the first row, the second index as the first column of a matrix. consider this:
print $B = sequence(3,2)
[
[0 1 2]
[3 4 5]
]
which gives a 2x3 matrix in terms of the matrix convention, but the constructor used (3,2). this might get more confusing when using slices like sequence(3,2)->slice("1:2,(0)"): with traditional matrix convention one would expect [2 4] instead of [1 2] π
this subclass PDL::Matrix overloads the constructors and indexing functions of pdls so that they are compatible with the usual matrix convention, where the first dimension refers to the row of a matrix. so now, the above example would be written as:
print $B = PDL::Matrix->sequence(3,2) # or $B = msequence(3,2)
[
[0 1]
[2 3]
[4 5]
]
routines like eigens or inv can be used without any changes π₯
furthermore one can construct and use vectors as n x 1 matrices without mentioning the second index '1' π
π§ Implementation π§
PDL::Matrix works by overloading a number of PDL constructors and methods such that first and second args (corresponding to first and second dims of corresponding matrices) are effectively swapped. it is not yet clear if PDL::Matrix achieves a consistent column-major look-and-feel in this way π€
π NOTES π
as of version 0.5 (rewrite by CED) the matrices are stored in the usual way, just constructed and stringified differently. that way indexing and everything else works the way you think it should β¨
π¦ FUNCTIONS π¦
π mpdl, PDL::Matrix::pdl
constructs an object of class PDL::Matrix which is an ndarray child class π
$m = mpdl [[1,2,3],[4,5,6]];
$m = PDL::Matrix->pdl([[1,2,3],[4,5,6]]);
π mzeroes, mones, msequence
constructs a PDL::Matrix object similar to the ndarray constructors zeroes, ones, sequence π
π vpdl
constructs an object of class PDL::Matrix which is of matrix dimensions (n x 1) β¨
print $v = vpdl [0,1];
[
[0]
[1]
]
π vzeroes, vones, vsequence
constructs a PDL::Matrix object with matrix dimensions (n x 1), therefore only the first scalar argument is used π
print $v = vsequence(2);
[
[0]
[1]
]
π kroneckerproduct
returns kroneckerproduct of two matrices. this is not efficiently implemented π
π det_general
returns a generalized determinant of a matrix. if the matrix is not regular, one can specify the rank of the matrix and the corresponding subdeterminant is returned. this is implemented using the eigens function π₯
π trace
returns the trace of a matrix (sum of diagonals) π
π BUGS AND PROBLEMS π
because we change the way ndarrays are constructed, not all pdl operators may be applied to ndarray-matrices. the inner product is not redefined. we might have missed some functions/methods. internal consistency of our approach needs yet to be established π
because PDL::Matrix changes the way slicing behaves, it breaks many operators, notably those in MatrixOps π¨
π TODO π
check all PDL functions, benchmarks, optimization, lots of other things ... β¨
π AUTHOR(S) π
Stephan Heuel (stephan@heuel.org), Christian Soeller (c.soeller@auckland.ac.nz). π
π COPYRIGHT π
all rights reserved. there is no warranty. you are allowed to redistribute this software / documentation under certain conditions. for details, see the file COPYING in the PDL distribution. if this file is separated from the PDL distribution, the copyright notice should be included in the file. π«Ά
okay bestie, that's the whole PDL::Matrix(3pm) page β it came from perl v5.42.3 and is dated 2026-08-20. bye, love u, go slay some matrices β¨π¦π
π¦ where this page comes from
- ubuntu stonking: pdl 1:2.106-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms