in reply to Re: PDL works for real number matrix operations, but not working for complex number matrix operations.
in thread PDL works for real number matrix operations, but not working for complex number matrix operations.
The results from running the above script are:#! /usr/bin/perl -w use warnings; use strict; use PDL; my $matrixM = pdl [ [ 1, 2,-1,-1], [ 1, 2, 2, 1], [ 1, 1, 1, 2], [-2,-1, 1, 2] ]; my $matrixB = pdl [ [5],[10], [8],[-5] ]; my $matrixX; print "\$matrixM = ", $matrixM,"<br>\n"; print "\$matrixB = ", $matrixB,"<br>\n"; print "\$matrixX = ", $matrixM->inv x $matrixB,"<br>\n"; exit(0);
This says that Xsub1 = 3+i, and Xsub2 = 2+i .....which is the correct result!$matrixM = [ [ 1 2 -1 -1] [ 1 2 2 1] [ 1 1 1 2] [-2 -1 1 2]] $matrixB = [ [ 5] [10] [ 8] [-5]] $matrixX = [ [ 3] [ 2] [ 1] [ 1]]
The results from running the above script are:#! /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] ];<br> my $matrixB = pdl [ 5+8*i, 10-5*i ]; my $matrixX; print "\$matrixM = ",$matrixM,"<br>\n"; print "\$matrixB = ", $matrixB,"<br>\n"; print "\$matrixX = ", $matrixM->inv x $matrixB,"<br>\n"; exit(0);
So my question is why am I getting such a clearly erroneous result when I run the second piece of code?$matrixM =[ [ [1 1] [2 1] ] [ [ 1 -2] [ 2 -1] ] ] $matrixB =[ [ 5 8] [10 -5] ] $matrixX = [ [ [ 5 -13] [ 0 21] ] [ [ 5 -6] [ 0 -7] ] ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: PDL works for real number matrix operations, but not working for complex number matrix operations.
by Anno (Deacon) on Mar 19, 2007 at 21:58 UTC | |
|
Re^3: PDL works for real number matrix operations, but not working for complex number matrix operations.
by Anno (Deacon) on Mar 20, 2007 at 21:48 UTC | |
by gmacfadden (Sexton) on Mar 21, 2007 at 17:00 UTC | |
by etj (Priest) on Jun 21, 2022 at 17:44 UTC |