http://qs1969.pair.com?node_id=480466

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.
#!/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;
Does this look OK to people or not?