The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PDL::LinearAlgebra::Special - Special matrices for PDL

SYNOPSIS

 use PDL::LinearAlgebra::Special;

 $a = mhilb(5,5);

DESCRIPTION

This module provides some constructors of well known matrices.

FUNCTIONS

mhilb

Construct Hilbert matrix from specifications list or template ndarray

 PDL(Hilbert)  = mpart(PDL(template) | ARRAY(specification))
 my $hilb   = mhilb(float,5,5);

mtri

Return zeroed matrix with upper or lower triangular part from another matrix. Return trapezoid matrix if entry matrix is not square. Supports threading. 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

Return (primal) Vandermonde matrix from vector.

mvander(M,P) is a rectangular version of mvander(P) with M Columns.

mpart

Return antisymmetric and symmetric part of a real or complex square matrix.

 ( 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

Return Hankel matrix also known as persymmetric matrix. Handles complex data.

 mhankel(c,r), where c and r are vectors, returns matrix whose first column
 is c and whose last row is r. The last element of c prevails.
 mhankel(c) returns matrix with element below skew diagonal (anti-diagonal) equals
 to zero. If c is a scalar number, make it from 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, it's determinant can be computed by:

                        floor(n/2)    n
        Det(H(n)) = (-1)      *      n

mtoeplitz

Return toeplitz matrix. Handles complex data.

 mtoeplitz(c,r), where c and r are vectors, returns matrix whose first column
 is c and whose last row is r. The last element of c prevails.
 mtoeplitz(c) returns symmetric matrix.

mpascal

Return Pascal matrix (from Pascal's triangle) of order N.

 mpascal(N,uplo).
 uplo:
        0 => upper triangular (Cholesky factor),
        1 => lower triangular (Cholesky factor),
        2 => symmetric.

This matrix is obtained by 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, its inverse has integer entries.

Their determinants are all equal to one and:

        S = L * U
        where S, L, U are symmetric, lower and upper pascal matrix respectively.

mcompanion

Return a matrix with characteristic polynomial equal to p if p is monic. 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 (here p is in descending order).

 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.