smh has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am trying to do complex matrix multiplication using PDL. I used an example from here, however, I get an error.
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);
I just extended the matrix from 2x2 to a 3x3, I get an error "PDL: inverse needs a square PDL as a matrix"
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);
Thanks in advance,
smh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with complex matrix multiplication using PDL
by cord-bin (Friar) on Oct 06, 2012 at 06:07 UTC | |
|
Re: problem with complex matrix multiplication using PDL
by zentara (Cardinal) on Oct 06, 2012 at 13:57 UTC | |
|
Re: problem with complex matrix multiplication using PDL
by etj (Priest) on May 22, 2022 at 19:24 UTC | |
|
Re: problem with complex matrix multiplication using PDL
by Athanasius (Archbishop) on Oct 07, 2012 at 06:44 UTC | |
by smh (Acolyte) on Oct 09, 2012 at 04:27 UTC | |
by Athanasius (Archbishop) on Oct 09, 2012 at 06:37 UTC |