Trans(3pm)

πŸ“¦
version 0.38 Β· 3 versions
, in ubuntu noble

πŸ’– 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 routine sec. 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 of 6 is 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