<?xml version="1.0" encoding="windows-1252"?>
<node id="997562" title="problem with complex matrix multiplication using PDL" created="2012-10-05 21:59:53" updated="2012-10-05 21:59:53">
<type id="115">
perlquestion</type>
<author id="857336">
smh</author>
<data>
<field name="doctext">
&lt;p&gt; Hi,
I am trying to do complex matrix multiplication using PDL. I used an example from here, however, I get an error.&lt;/p&gt;

 &lt;code&gt; 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-&gt;inv,"\n";

print "\n\n+++++++++++++++++++++++++\n\n";
exit(0);
&lt;/code&gt;

&lt;p&gt; I just extended the matrix from 2x2 to a 3x3, I get an error "PDL: inverse needs a square PDL as a matrix" &lt;/p&gt;


&lt;code&gt; 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-&gt;inv,"\n";

print "\n\n+++++++++++++++++++++++++\n\n";
exit(0);
&lt;/code&gt;

&lt;p&gt; Thanks in advance,&lt;/p&gt;
&lt;p&gt; smh &lt;/p&gt;</field>
</data>
</node>
