PDL::L...Special(3pm)
π PDL::L...Special π
okay bestie, gather round, because this is the PDL::LinearAlgebra::Special page from the User Contributed Perl Documentation, and it is literally your one-stop shop for building famous matrices without doing the math yourself. it's giving constructor-core. π
β¨ NAME β¨
PDL::LinearAlgebra::Special β Special matrices for PDL π¦
πΈ SYNOPSIS πΈ
use PDL::LinearAlgebra::Special;
$a = mhilb(5,5);
like, that's it. that's the whole vibe check. π
π« DESCRIPTION π«
so this module is basically a lil friend group of constructors for well known matrices. you want a famous matrix? boom, it's here. you want to build it by hand and suffer? not on this module's watch. no cap. β¨
π₯ FUNCTIONS π₯
π mhilb
constructs a Hilbert matrix, either from a specifications list or from a template ndarray. iconic behaviour fr fr.
PDL(Hilbert) = mpart(PDL(template) | ARRAY(specification))
my $hilb = mhilb(float,5,5);
π§ mtri
returns a zeroed matrix with the upper or lower triangular part pulled from another matrix. and if the matrix you hand it isn't square? you get a trapezoid matrix instead. it supports broadcasting, bestie, we love that. it uses tricpy or tricpy. π
PDL = mtri(PDL, SCALAR)
SCALAR : UPPER = 0 | LOWER = 1, default = 0
my $a = random(10,10);
my $b = mtri($a, 0);
π mvander
returns a (primal) Vandermonde matrix from a vector. slay.
mvander(M,P) is a rectangular version of mvander(P) with M Columns.
π mpart
returns the antisymmetric and symmetric part of a real or complex square matrix. it's giving split-it-in-two energy. π
( PDL(antisymmetric), PDL(symmetric) ) = mpart(PDL, SCALAR(conj))
conj : if true Return AntiHermitian, Hermitian part.
my $a = random(10,10);
my ( $antisymmetric, $symmetric ) = mpart($a);
π mhankel
returns a Hankel matrix, also known as a persymmetric matrix. and yes it handles complex data, we're not scared of complex here. π
mhankel(c,r), where c and r are vectors, returns a matrix whose first column is c and whose last row is r. The last element of c prevails. mhankel(c) returns a matrix with the element below the skew diagonal (anti-diagonal) equal to zero. If c is a scalar number, make it from a sequence beginning at one.
the elements are:
H (i,j) = c (i+j), i+j+1 <= m;
H (i,j) = r (i+j-m+1), otherwise
where m is the size of the vector.
if c is a scalar number, its determinant can be computed by:
floor(n/2) n
Det(H(n)) = (-1) * n
β mtoeplitz
returns a toeplitz matrix. also handles complex data. we stay versatile. π
mtoeplitz(c,r), where c and r are vectors, returns a matrix whose first column is c and whose last row is r. The last element of c prevails. mtoeplitz(c) returns a symmetric matrix.
π mpascal
returns a Pascal matrix (yes, from Pascal's triangle) of order N.
mpascal(N,uplo).
uplo:
0 => upper triangular (Cholesky factor),
1 => lower triangular (Cholesky factor),
2 => symmetric.
so this matrix comes from writing Pascal's triangle (whose elements are binomial coefficients from index and/or index sum) as a matrix and truncating appropriately. the symmetric Pascal is positive definite, and its inverse has integer entries. highkey elegant.
their determinants are all equal to one, and:
S = L * U
where S, L, U are symmetric, lower and upper pascal matrix respectively.
π¦ mcompanion
returns a matrix with characteristic polynomial equal to p if p is monic. and if p is not monic, the characteristic polynomial of A is equal to p/c, where c is the coefficient of largest degree in p (and here p is in descending order, bestie, don't forget).
mcompanion(PDL(p),SCALAR(charpol)).
charpol:
0 => first row is -P(1:n-1)/P(0),
1 => last column is -P(1:n-1)/P(0),
π AUTHOR π
Copyright (C) GrΓ©gory Vanuxem 2005-2007. π«Ά
This library is free software; you can redistribute it and/or modify it under the terms of the artistic license as specified in the Artistic file.
and that's the whole page, bestie β no notes, you ate. π β¨
signing off: this was perl v5.42.3, dated 2026-08-21, from the PDL::L...Special(3pm) era of the User Contributed Perl Documentation. stay special. ππ¦π
π¦ where this page comes from
- ubuntu stonking: libpdl-linearalgebra-perl 0.437-1build1 Β· Artistic-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms