.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Trans 3pm" .TH Trans 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME PDL::LinearAlgebra::Trans \- Linear Algebra based transcendental functions for PDL .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use PDL::LinearAlgebra::Trans; \& \& $a = random (100,100); \& $sqrt = msqrt($a); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides some transcendental functions for matrices. Moreover it provides sec, asec, sech, asech, cot, acot, acoth, coth, csc, acsc, csch, acsch. Beware, importing this module will overwrite the hidden PDL routine sec. If you need to call it specify its origin module : PDL::Basic::sec(args) .SH FUNCTIONS .IX Header "FUNCTIONS" .SS geexp .IX Subsection "geexp" .Vb 1 \& Signature: ([io,phys]A(n,n);int deg();scale();[io]trace();int [o]ns();int [o]info(); int [t]ipiv(n); [t]wsp(wspn)) .Ve .PP 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 .PP .Vb 2 \& A: On input 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 perform \& a trace normalization. On output 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 .Ve .PP .Vb 3 \& = random(5,5); \& = pdl(1); \& \->t\->geexp(6,1,, ( = null), ( = null)); .Ve .PP 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. .SS cgeexp .IX Subsection "cgeexp" .Vb 1 \& Signature: (complex [io,phys]A(n,n);int deg();scale();int trace();int [o]ns();int [o]info(); int [t] ipiv(n)) .Ve .PP 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 .SS ctrsqrt .IX Subsection "ctrsqrt" .Vb 1 \& Signature: (complex [io,phys]A(n,n);int uplo();complex [phys,o] B(n,n);int [o]info()) .Ve .PP 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. .SS ctrfun .IX Subsection "ctrfun" .Vb 1 \& Signature: (complex [io]A(n,n);int uplo();complex [o] B(n,n);int [o]info(); complex [t]diag(n);SV* func) .Ve .PP Apply an arbitrary function to a complex triangular matrix. Uses a recurrence of Parlett. If uplo is true, A is lower triangular. .SS mlog .IX Subsection "mlog" Return matrix logarithm of a square matrix. .PP .Vb 1 \& PDL = mlog(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $log = mlog($a); .Ve .SS msqrt .IX Subsection "msqrt" Return matrix square root (principal) of a square matrix. .PP .Vb 1 \& PDL = msqrt(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $sqrt = msqrt($a); .Ve .SS mexp .IX Subsection "mexp" Return matrix exponential of a square matrix. .PP .Vb 1 \& PDL = mexp(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $exp = mexp($a); .Ve .SS mpow .IX Subsection "mpow" Return matrix power of a square matrix. .PP .Vb 1 \& PDL = mpow(PDL(A), SCALAR(exponent)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $powered = mpow($a,2.5); .Ve .SS mcos .IX Subsection "mcos" Return matrix cosine of a square matrix. .PP .Vb 1 \& PDL = mcos(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $cos = mcos($a); .Ve .SS macos .IX Subsection "macos" Return matrix inverse cosine of a square matrix. .PP .Vb 1 \& PDL = macos(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $acos = macos($a); .Ve .SS msin .IX Subsection "msin" Return matrix sine of a square matrix. .PP .Vb 1 \& PDL = msin(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $sin = msin($a); .Ve .SS masin .IX Subsection "masin" Return matrix inverse sine of a square matrix. .PP .Vb 1 \& PDL = masin(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $asin = masin($a); .Ve .SS mtan .IX Subsection "mtan" Return matrix tangent of a square matrix. .PP .Vb 1 \& PDL = mtan(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $tan = mtan($a); .Ve .SS matan .IX Subsection "matan" Return matrix inverse tangent of a square matrix. .PP .Vb 1 \& PDL = matan(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $atan = matan($a); .Ve .SS mcot .IX Subsection "mcot" Return matrix cotangent of a square matrix. .PP .Vb 1 \& PDL = mcot(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $cot = mcot($a); .Ve .SS macot .IX Subsection "macot" Return matrix inverse cotangent of a square matrix. .PP .Vb 1 \& PDL = macot(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $acot = macot($a); .Ve .SS msec .IX Subsection "msec" Return matrix secant of a square matrix. .PP .Vb 1 \& PDL = msec(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $sec = msec($a); .Ve .SS masec .IX Subsection "masec" Return matrix inverse secant of a square matrix. .PP .Vb 1 \& PDL = masec(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $asec = masec($a); .Ve .SS mcsc .IX Subsection "mcsc" Return matrix cosecant of a square matrix. .PP .Vb 1 \& PDL = mcsc(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $csc = mcsc($a); .Ve .SS macsc .IX Subsection "macsc" Return matrix inverse cosecant of a square matrix. .PP .Vb 1 \& PDL = macsc(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $acsc = macsc($a); .Ve .SS mcosh .IX Subsection "mcosh" Return matrix hyperbolic cosine of a square matrix. .PP .Vb 1 \& PDL = mcosh(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $cos = mcosh($a); .Ve .SS macosh .IX Subsection "macosh" Return matrix hyperbolic inverse cosine of a square matrix. .PP .Vb 1 \& PDL = macosh(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $acos = macosh($a); .Ve .SS msinh .IX Subsection "msinh" Return matrix hyperbolic sine of a square matrix. .PP .Vb 1 \& PDL = msinh(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $sinh = msinh($a); .Ve .SS masinh .IX Subsection "masinh" Return matrix hyperbolic inverse sine of a square matrix. .PP .Vb 1 \& PDL = masinh(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $asinh = masinh($a); .Ve .SS mtanh .IX Subsection "mtanh" Return matrix hyperbolic tangent of a square matrix. .PP .Vb 1 \& PDL = mtanh(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $tanh = mtanh($a); .Ve .SS matanh .IX Subsection "matanh" Return matrix hyperbolic inverse tangent of a square matrix. .PP .Vb 1 \& PDL = matanh(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $atanh = matanh($a); .Ve .SS mcoth .IX Subsection "mcoth" Return matrix hyperbolic cotangent of a square matrix. .PP .Vb 1 \& PDL = mcoth(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $coth = mcoth($a); .Ve .SS macoth .IX Subsection "macoth" Return matrix hyperbolic inverse cotangent of a square matrix. .PP .Vb 1 \& PDL = macoth(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $acoth = macoth($a); .Ve .SS msech .IX Subsection "msech" Return matrix hyperbolic secant of a square matrix. .PP .Vb 1 \& PDL = msech(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $sech = msech($a); .Ve .SS masech .IX Subsection "masech" Return matrix hyperbolic inverse secant of a square matrix. .PP .Vb 1 \& PDL = masech(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $asech = masech($a); .Ve .SS mcsch .IX Subsection "mcsch" Return matrix hyperbolic cosecant of a square matrix. .PP .Vb 1 \& PDL = mcsch(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $csch = mcsch($a); .Ve .SS macsch .IX Subsection "macsch" Return matrix hyperbolic inverse cosecant of a square matrix. .PP .Vb 1 \& PDL = macsch(PDL(A)) .Ve .PP .Vb 2 \& my $a = random(10,10); \& my $acsch = macsch($a); .Ve .SS mfun .IX Subsection "mfun" Return matrix function of second argument of a square matrix. Function will be applied on a complex ndarray. .PP .Vb 1 \& PDL = mfun(PDL(A),\*(Aqcos\*(Aq) .Ve .PP .Vb 12 \& my $a = random(10,10); \& my $fun = mfun($a,\*(Aqcos\*(Aq); \& sub sinbycos2{ \& $_[0]\->set_inplace(0); \& $_[0] .= $_[0]\->Csin/$_[0]\->Ccos**2; \& } \& # Try diagonalization \& $fun = mfun($a, \e&sinbycos2,1); \& # Now try Schur/Parlett \& $fun = mfun($a, \e&sinbycos2); \& # Now with function. \& scalar msolve($a\->mcos\->mpow(2), $a\->msin); .Ve .SH TODO .IX Header "TODO" Improve error return and check singularity. Improve (msqrt,mlog) / r2C .SH AUTHOR .IX Header "AUTHOR" Copyright (C) Grégory Vanuxem 2005\-2018. .PP 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.