Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Inversion on a non square matrix using PDL (or similar?)

by Angharad (Pilgrim)
on Jul 28, 2005 at 16:34 UTC ( #479031=perlquestion: print w/replies, xml ) Need Help??
Angharad has asked for the wisdom of the Perl Monks concerning the following question:

I'm having a little play with PDL at the moment. Neat but I was wondering if anyone knew of a way in which you can invert a matrix that isnt square.
There is a function in MatLab called pinv which will invert a rectangular matrix. Perhaps there is something similar offered in PDL?
Or, if not, does anyone know of another way to implement this using Perl?
  • Comment on Inversion on a non square matrix using PDL (or similar?)

Replies are listed 'Best First'.
Re: Inversion on a non square matrix using PDL (or similar?)
by gjb (Vicar) on Jul 28, 2005 at 16:56 UTC

    You're looking for the Moore-Penrose pseudoinverse. It is defined on MathWorld and is easy to implement for a matrix A as (A^t A)^{-1} A^t where A^t is A transposed, A^t A is a square matrix, (A^t A)^{-1} being its inverse (if it exists).

    Hope this helps, -gjb-

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://479031]
Approved by gjb
help
Chatterbox?
[atcroft]: james28909: That particular questions was a bit of trick, actually (depending on the country you are in). More interesting is, if you are trying to subtract from an epoch time, for instance, you might have to consider when/if DST occurs for a location,
[atcroft]: because you may have to adjust the number of seconds you change from an epoch from 86400 (not to mention leap seconds)....
[atcroft]: james28909: Although if your program is using a database, you might be able to "pass the buck" to the database and ask it to do the date change for you....
[stevieb]: ++ atcroft

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2017-04-29 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.