perlquestion
smh
<p> Hi,
I am trying to do complex matrix multiplication using PDL. I used an example from here, however, I get an error.</p>
<code> 2x2 matrix *** this works fine ****
#! /usr/bin/perl -w
use warnings;
use strict;
use PDL;
use PDL::Complex;
my $matrixM = pdl [ [ 1+1*i, 2+1*i],
[ 1-2*i, 2-1*i]
];
print "Via Perl Data Language\n";
print "List assigned_values of matrices:\n";
print "\$matrixM = ", $matrixM,"\n";
print "\n Inv of \$matrixM = ", $matrixM->inv,"\n";
print "\n\n+++++++++++++++++++++++++\n\n";
exit(0);
</code>
<p> I just extended the matrix from 2x2 to a 3x3, I get an error "PDL: inverse needs a square PDL as a matrix" </p>
<code> 3x3 matrix *** does not work ****
#! /usr/bin/perl -w
use warnings;
use strict;
use PDL;
use PDL::Complex;
my $matrixM = pdl [ [ 1+1*i, 2+1*i, 3+1*i],
[ 1-2*i, 2-1*i, -2+1*i],
[ -1+1*i, 2+1*i, -1+1*i]
];
print "Via Perl Data Language\n";
print "List assigned_values of matrices:\n";
print "\$matrixM = ", $matrixM,"\n";
print "\n Inv of \$matrixM = ", $matrixM->inv,"\n";
print "\n\n+++++++++++++++++++++++++\n\n";
exit(0);
</code>
<p> Thanks in advance,</p>
<p> smh </p>