Angharad has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
Further to a post I made a day or so ago regarding the pseudoinverse of a mxn matrix, I proceeded to create the following script .. attempting to implement the equation pseudoinvB = (B^tB)^-1B^t where B^t = transpose of non square matrix B.
Further to a post I made a day or so ago regarding the pseudoinverse of a mxn matrix, I proceeded to create the following script .. attempting to implement the equation pseudoinvB = (B^tB)^-1B^t where B^t = transpose of non square matrix B.
Does this look OK to people or not?#!/usr/bin/perl use PDL; my $matrix = pdl [ [4, 2, 9], [2, 5, 5], [6, 3, 5], [8, 4, 6], ]; ($a, $b, $c) = svd($matrix); $bt = transpose($b); $B1 = $bt*$b; $B2 = $B1^-1; $pseudoB = $B2*$bt;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pseudoinversing matrix .. is this correct?
by etj (Deacon) on Jun 21, 2022 at 19:56 UTC | |
Re: Pseudoinversing matrix .. is this correct?
by wufnik (Friar) on Aug 03, 2005 at 14:52 UTC | |
by Angharad (Pilgrim) on Aug 03, 2005 at 15:02 UTC | |
Re: Pseudoinversing matrix .. is this correct?
by tall_man (Parson) on Aug 11, 2005 at 23:18 UTC |
Back to
Seekers of Perl Wisdom