The PDL documentation system can be helpful in finding routines.  For
example, if I
do 'apropos inverse' at the PDL shell prompt or 'pdldoc -a inverse' at the
command/bash
prompt the result is:

> erfi            The inverse of the error function. Works inplace.
> getri           Computes the inverse of a matrix using the LU
> factorization computed by `getrf'.
> ifft            Complex inverse 1-D FFT of the "real" and "imag" arrays
> [inplace].
> ifftnd          N-dimensional inverse FFT over all pdl dims of input
> (inplace)
> invert          Apply an inverse transformation to some input coordinates.
> macos           Return matrix inverse cosine of a square matrix.
> macosh          Return matrix hyperbolic inverse cosine of a square matrix.
> macot           Return matrix inverse cotangent of a square matrix.
> macoth          Return matrix hyperbolic inverse cotangent of a square
> matrix.
> macsc           Return matrix inverse cosecant of a square matrix.
> macsch          Return matrix hyperbolic inverse cosecant of a square
> matrix.
> masec           Return matrix inverse secant of a square matrix.
> masech          Return matrix hyperbolic inverse secant of a square matrix.
> masin           Return matrix inverse sine of a square matrix.
> masinh          Return matrix hyperbolic inverse sine of a square matrix.
> matan           Return matrix inverse tangent of a square matrix.
> matanh          Return matrix hyperbolic inverse tangent of a square
> matrix.
> matinv          Inverse of a square matrix
> minv            Computes inverse of a general square matrix using LU
> factorization. Supports inplace and threading. Uses getrf and getri or
> cgetrf and cgetri from Lapack and returns `inverse, info' in array context.
> mpascal         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, it's inverse has
>                 integer entries.
> mpinv           Computes pseudo-inverse (Moore-Penrose) of a general
> matrix. Works on transposed array.
> mposinv         Computes inverse of a symmetric positive definite square
> matrix using Cholesky factorization. Supports inplace and threading. Uses
> potrf and potri or cpotrf and cpotri from Lapack and returns `inverse,
> info' in array context.
> msyminv         Computes inverse of a symmetric square matrix using the
> Bunch-Kaufman diagonal pivoting method. Supports inplace and threading.
> Uses sytrf and sytri or csytrf and csytri from Lapack and returns `inverse,
> info' in array context.
> mtriinv         Computes inverse of a triangular matrix. Supports inplace
> and threading. Uses trtri or ctrtri from Lapack. Returns `inverse, info' in
> array context.
> potri           Computes the inverse of a real symmetric positive definite
> matrix A using the Cholesky factorization A = U'*U or A = L*L' computed by
> `potrf'.
> realifft        Inverse of one-dimensional realfft routine [inplace].
> setlaerror      Sets action type when an error is encountered, returns
> previous type. Available values are NO, WARN and BARF (predefined
> constants). If, for example, in computation of the inverse, singularity is
> detected, the routine can silently
>                 return values from computation (see manuals), warn about
> singularity or barf. BARF is the default value.
> sytri           Computes the inverse of a real symmetric indefinite matrix
> A using the factorization A = U*D*U' or A = L*D*L' computed by `sytrf'.
> t_cubic         Cubic scaling - cubic pincushion (n-d; with inverse)
> t_fits          FITS pixel-to-scientific transformation with inverse
> t_inverse       Return the inverse of a PDL::Transform. This just reverses
> the func/inv, idim/odim, itype/otype, and iunit/ounit pairs. Note that
> sometimes you end up with a transform that cannot be applied or mapped,
> because either the
>                 mathematical inverse doesn't exist or the inverse func
> isn't implemented.
> t_quadratic     Quadratic scaling -- cylindrical pincushion (n-d; with
> inverse)
> t_quartic       Quartic scaling -- cylindrical pincushion (n-d; with
> inverse)
> t_radial        Convert Cartesian to radial/cylindrical coordinates.
> (2-D/3-D; with inverse)
> t_spherical     Convert Cartesian to spherical coordinates. (3-D; with
> inverse)
> trti2           Computes the inverse of a real upper or lower triangular
> matrix A.
> trtri           Computes the inverse of a real upper or lower triangular
> matrix A.
> unmap           Map an image or N-D dataset using the inverse as a
> coordinate transform.
>
>
Which includes the minv() routine.  Then 'help minv' or 'pdldoc minv'
yields:

>  pdldoc minv
> Module PDL::LinearAlgebra
>   minv
>     Computes inverse of a general square matrix using LU factorization.
>     Supports inplace and threading. Uses getrf and getri or cgetrf and
>     cgetri from Lapack and returns "inverse, info" in array context.
>
>      PDL(inv)  = minv(PDL)
>
>      my $a = random(10,10);
>      my $inv = minv($a);
>
>     Docs from
>
> /cygdrive/f/perl/local64/lib/perl5/cygwin-thread-multi/PDL/LinearAlgebra
>     .pm
>
>
Hope this helps,
Chris

On Thu, Jun 25, 2015 at 3:56 PM, Chris Marshall <[email protected]>
wrote:

> I took a look at the documentation for the PDL::LinearAlgebra module and
> saw the minv() routine which calculates either the real or complex matrix
> inverse depending on the input.  This pdl2 session seems to work:
>
> pdl> use
>> PDL::Complex
>>
>> pdl> use
>> PDL::LinearAlgebra
>>
>> pdl> $A =
>> random(2,5,5);
>>
>> pdl> $cA =
>> cplx($A);
>>
>> pdl> p
>> $cA
>>
>>
>> [
>>  [ 0.648021 +0.221663i   0.793256 +0.588205i    0.28706 +0.918206i
>> 0.504137 +0.260584i   0.527557  +0.10499i]
>>  [ 0.388552 +0.404901i   0.537276 +0.531932i   0.314593 +0.209973i
>> 0.0828364  +0.95625i   0.593174+0.0143707i]
>>  [ 0.630699   +0.4122i   0.379448 +0.895322i   0.795139 +0.351844i
>> 0.497338 +0.900724i   0.884001  +0.78247i]
>>  [0.0803632 +0.201913i   0.801213  +0.80519i    0.68765 +0.723879i
>> 0.831798 +0.644938i   0.504724 +0.208855i]
>>  [ 0.295086 +0.222764i  0.0040192  +0.84586i   0.842631+0.0657471i
>> 0.978252  +0.47564i   0.389874 +0.277407i]
>> ]
>>
>> pdl> p
>> minv($cA)
>>
>>
>> [
>>  [  0.889801  -0.40207i    0.403404 -0.612824i    0.184086  +0.54255i
>> -1.40804 +0.372943i    0.444733 -0.422639i]
>>  [ -0.353338 -0.173588i    0.360513 -0.489879i    0.241815 +0.663846i
>> 0.744675 +0.102151i   -0.862411 -0.845977i]
>>  [-0.0207381 -0.796744i     0.34137 +0.488185i   -0.302943 +0.296069i
>> -0.110737 -0.162525i    0.683827+0.0482191i]
>>  [-0.0997267 +0.670967i   -0.690927 -0.585443i    0.171827 -0.226967i
>> 0.376287 -0.294396i   0.0855393 +0.323581i]
>>  [  0.146725 +0.623492i   -0.592009  +1.07667i    0.462729  -1.60548i
>> 0.0563088  -0.48494i    -0.36726  +1.07107i]
>> ]
>>  0
>> pdl>
>> q
>>
>>
>>
> On Thu, Jun 25, 2015 at 3:38 PM, Chris Marshall <[email protected]>
> wrote:
>
>> Hi Ben-
>>
>> I don't have experience with the PDL::LinearAlgebra::Complex routines so
>> I'm forwarding your message to the pdl-general mailing list at sf.net
>> which is where PDL support is handled.  Maybe another PDL user will have
>> experience using the cgtri() routine for complex matrix inversions.  Please
>> see http://lists.sourceforge.net/lists/listinfo/pdl-general
>> to sign up for the mailing list.
>>
>> Regards,
>> Chris
>>
>>
>> On Thu, Jun 25, 2015 at 1:07 AM, Benjamin Silva <[email protected]>
>> wrote:
>>
>>> Hi Chris,
>>>
>>> I hope that you don't mind me contacting you directly, but I'm a bit
>>> stuck and I don't really know where else to turn.  Years ago, I had written
>>> some subroutines in perl that did inversion of complex matrices, but
>>> they're of course very slow.  I mean VERY slow.  I have recently been
>>> trying to get PDL to work just to see how terrible my previous work was,
>>> and I've got it working for real matrices.  It's very fast, as expected.
>>> However, when I try to implement the PDL module for complex matrices, I
>>> cannot get it to work.
>>>
>>> I've attached two files here.  The first one is for real matrices, and
>>> I'm comparing PDL::Slatec with PDL::LinearAlgebra with my old subroutine
>>> that was written for complex numbers, but should still work for real as
>>> well (please don't laugh at my code too hard!).  The second file is my best
>>> attempt at getting complex to work using the 'cgetri' subroutine, but it
>>> just crashes perl on me when I run it.
>>>
>>> Do you have any insight or can you send me some examples of how to use
>>> PDL to do matrix inversion on matrices of complex numbers?  Failing that,
>>> any links or documents you can point me to?  I've been using perl for a
>>> while, but I'd say my skills are quite sub-par.  I'm not really a coder, so
>>> it's hard for me to understand a lot of the code I see.
>>>
>>> Thanks for any help or guidance you can lend!
>>> -Ben
>>>
>>>
>>
>
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to