Trans(3pm)
π Trans β PDL::LinearAlgebra::Trans π
okay bestie, gather round π«Ά this is the manual page for PDL::LinearAlgebra::Trans, the Linear Algebra based transcendental functions for PDL. Yes the name is giving "math class" but the energy is giving "we're doing matrix trig and we're thriving" β¨
π SYNOPSIS π
use PDL::LinearAlgebra::Trans;
$a = random (100,100);
$sqrt = msqrt($a);
literally two lines and you're already doing matrix square roots, slay π
β¨ DESCRIPTION β¨
So this module hands you a whole lil' bundle of transcendental functions for matrices π¦. On top of that it also brings you sec, asec, sech, asech, cot, acot, acoth, coth, csc, acsc, csch, acsch πΈ.
β οΈ BEWARE bestie, this is the important part: importing this module will overwrite the hidden PDL routinesec. So if you need to call the original one, you gotta specify its origin module like this:PDL::Basic::sec(args)π
π FUNCTIONS π
π geexp
Signature:
([io,phys]A(n,n);int deg();scale();[io]trace();int [o]ns();int [o]info(); int [t]ipiv(n); [t]wsp(wspn))
Computes exp(t*A), the matrix exponential of a general matrix, using the irreducible rational Pade approximation to the exponential function
exp(x) = r(x) = (+/-)( I + 2*(q(x)/p(x)) )
combined with scaling-and-squaring and optionally normalization of the trace π₯. The algorithm is described in Roger B. Sidje (rbs.uq.edu.au) "EXPOKIT: Software Package for Computing Matrix Exponentials". ACM - Transactions On Mathematical Software, 24(1):130-156, 1998 π.
Aβ On input, the argument matrix. On output,exp(t*A). Use Fortran storage type.degβ the degre of the diagonal Pade to be used. A value of6is generally satisfactory.scaleβ time-scale (can be< 0).traceβ on input, boolean value indicating whether or not to perform a trace normalization. On output, the value used.nsβ on output, number of scaling-squaring used.infoβ exit flag.0β no problem> 0β Singularity in LU factorization when solving Pade approximation
= random(5,5);
= pdl(1);
->t->geexp(6,1,, ( = null), ( = null));
geexp does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. π
π cgeexp
Signature:
(complex [io,phys]A(n,n);int deg();scale();int trace();int [o]ns();int [o]info(); int [t] ipiv(n))
Complex version of geexp π¦. The value used for trace normalization is not returned. The algorithm is described in Roger B. Sidje (rbs@maths.uq.edu.au) "EXPOKIT: Software Package for Computing Matrix Exponentials". ACM - Transactions On Mathematical Software, 24(1):130-156, 1998 π.
π ctrsqrt
Signature:
(complex [io,phys]A(n,n);int uplo();complex [phys,o] B(n,n);int [o]info())
Root square of complex triangular matrix π. Uses a recurrence of BjΓΆrck and Hammarling. (See Nicholas J. Higham. A new sqrtm for MATLAB. Numerical Analysis Report No. 336, Manchester Centre for Computational Mathematics, Manchester, England, January 1999. It's available at http://www.ma.man.ac.uk/~higham/pap-mf.html) If uplo is true, A is lower triangular β¨.
π ctrfun
Signature:
(complex [io]A(n,n);int uplo();complex [o] B(n,n);int [o]info(); complex [t]diag(n);SV* func)
Apply an arbitrary function to a complex triangular matrix π§. Uses a recurrence of Parlett. If uplo is true, A is lower triangular π.
π mlog
Return matrix logarithm of a square matrix.
PDL = mlog(PDL(A))
my $a = random(10,10);
my $log = mlog($a);
π msqrt
Return matrix square root (principal) of a square matrix.
PDL = msqrt(PDL(A))
my $a = random(10,10);
my $sqrt = msqrt($a);
π mexp
Return matrix exponential of a square matrix.
PDL = mexp(PDL(A))
my $a = random(10,10);
my $exp = mexp($a);
π mpow
Return matrix power of a square matrix.
PDL = mpow(PDL(A), SCALAR(exponent))
my $a = random(10,10);
my $powered = mpow($a,2.5);
π mcos
Return matrix cosine of a square matrix.
PDL = mcos(PDL(A))
my $a = random(10,10);
my $cos = mcos($a);
π macos
Return matrix inverse cosine of a square matrix.
PDL = macos(PDL(A))
my $a = random(10,10);
my $acos = macos($a);
π msin
Return matrix sine of a square matrix.
PDL = msin(PDL(A))
my $a = random(10,10);
my $sin = msin($a);
π masin
Return matrix inverse sine of a square matrix.
PDL = masin(PDL(A))
my $a = random(10,10);
my $asin = masin($a);
π mtan
Return matrix tangent of a square matrix.
PDL = mtan(PDL(A))
my $a = random(10,10);
my $tan = mtan($a);
π matan
Return matrix inverse tangent of a square matrix.
PDL = matan(PDL(A))
my $a = random(10,10);
my $atan = matan($a);
π mcot
Return matrix cotangent of a square matrix.
PDL = mcot(PDL(A))
my $a = random(10,10);
my $cot = mcot($a);
π macot
Return matrix inverse cotangent of a square matrix.
PDL = macot(PDL(A))
my $a = random(10,10);
my $acot = macot($a);
π msec
Return matrix secant of a square matrix.
PDL = msec(PDL(A))
my $a = random(10,10);
my $sec = msec($a);
π masec
Return matrix inverse secant of a square matrix.
PDL = masec(PDL(A))
my $a = random(10,10);
my $asec = masec($a);
π mcsc
Return matrix cosecant of a square matrix.
PDL = mcsc(PDL(A))
my $a = random(10,10);
my $csc = mcsc($a);
π macsc
Return matrix inverse cosecant of a square matrix.
PDL = macsc(PDL(A))
my $a = random(10,10);
my $acsc = macsc($a);
π mcosh
Return matrix hyperbolic cosine of a square matrix.
PDL = mcosh(PDL(A))
my $a = random(10,10);
my $cos = mcosh($a);
π macosh
Return matrix hyperbolic inverse cosine of a square matrix.
PDL = macosh(PDL(A))
my $a = random(10,10);
my $acos = macosh($a);
π msinh
Return matrix hyperbolic sine of a square matrix.
PDL = msinh(PDL(A))
my $a = random(10,10);
my $sinh = msinh($a);
π masinh
Return matrix hyperbolic inverse sine of a square matrix.
PDL = masinh(PDL(A))
my $a = random(10,10);
my $asinh = masinh($a);
π mtanh
Return matrix hyperbolic tangent of a square matrix.
PDL = mtanh(PDL(A))
my $a = random(10,10);
my $tanh = mtanh($a);
π matanh
Return matrix hyperbolic inverse tangent of a square matrix.
PDL = matanh(PDL(A))
my $a = random(10,10);
my $atanh = matanh($a);
π mcoth
Return matrix hyperbolic cotangent of a square matrix.
PDL = mcoth(PDL(A))
my $a = random(10,10);
my $coth = mcoth($a);
π macoth
Return matrix hyperbolic inverse cotangent of a square matrix.
PDL = macoth(PDL(A))
my $a = random(10,10);
my $acoth = macoth($a);
π msech
Return matrix hyperbolic secant of a square matrix.
PDL = msech(PDL(A))
my $a = random(10,10);
my $sech = msech($a);
π masech
Return matrix hyperbolic inverse secant of a square matrix.
PDL = masech(PDL(A))
my $a = random(10,10);
my $asech = masech($a);
π mcsch
Return matrix hyperbolic cosecant of a square matrix.
PDL = mcsch(PDL(A))
my $a = random(10,10);
my $csch = mcsch($a);
π macsch
Return matrix hyperbolic inverse cosecant of a square matrix.
PDL = macsch(PDL(A))
my $a = random(10,10);
my $acsch = macsch($a);
π mfun
Return matrix function of second argument of a square matrix π§βοΈ. Function will be applied on a complex ndarray.
PDL = mfun(PDL(A),'cos')
my $a = random(10,10);
my $fun = mfun($a,'cos');
sub sinbycos2{
$_[0]->set_inplace(0);
$_[0] .= $_[0]->Csin/$_[0]->Ccos**2;
}
# Try diagonalization
$fun = mfun($a, \&sinbycos2,1);
# Now try Schur/Parlett
$fun = mfun($a, \&sinbycos2);
# Now with function.
scalar msolve($a->mcos->mpow(2), $a->msin);
π TODO π
the to-do list, bestie, we're being honest here π
- Improve error return and check singularity.
- Improve (
msqrt,mlog) / r2C
πΈ AUTHOR πΈ
Copyright (C) GrΓ©gory Vanuxem 2005-2018.
This library is free software; you can redistribute it and/or modify it under the terms of the Perl Artistic License as in the file Artistic_2 in this distribution π.
and that's the whole page, no crumbs left πβ¨ This lil' doc was served up by perl v5.38.2, dated 2024-03-31, and it's the manual for Trans(3pm) β go forth and exponentiate your matrices, you icon ππ¦π
π¦ where this page comes from
- ubuntu noble: libpdl-linearalgebra-perl 0.38-1build2 Β· Artistic-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms