Mark,

I recall that some pdl functions are 'complex' aware and some are
not. In particular, I believe that the 'x' matrix multiplication
doesn't handle complex matrices. For example, consider the following
examples

  $ perl -MPDL -E '$a=pdl(1); say $a x $a;'

  [
   [1]
  ]

  $ perl -MPDL -MPDL::Complex -E '$a=pdl(i); say $a x $a;'
  Dim mismatch in matmult of [2x1] x [2x1]: 2 != 1 at ...

So I guess you have to do your own complex matrix multiplication, or
separate real and imaginary parts and replace
  ($R1+i*$I1) x ($R2+i*$I2)
by  
  ($R1 x $R2 - $I1 x $I2) +i*($R1 x $I2 + $I1 x $R2 )


About the -i, perl might consider it as the string "-i" since it
starts with a '-' (thus, you save on quotation marks when you use a
'-' to denote parameters), but in your case it means minus the imaginary unit
-&i, so perl guessed correctly but it warns you that it was an educated guess.

Regards,
Luis



On Mon, Feb 01, 2016 at 11:21:12PM +0000, Mark Baker wrote:
> 
> Hello All 
> 
>      I have been working on some Quantum Problems and have not been able to 
> get PDL to produce the right results 
> for the Pauli matrices ...
>           (($x x $y) - ($y x $x)) = $z ;  (($y x $z) - ($z x $y)) = $x;   
> (($z x $x)  -  ($x x $z)) = $y; 
>   where       $x = [ 0  1 ]       $y = [ 0  -i ]      $z = [ 1  0 ]
>                              [ 1  0 ]               [ i   0 ]               [ 
> 0  1 ]
> 
>           yet when I try to enter -i I get this use PDL::Complex;
> pdl> p $y = pdl( [ 0, -i ] , [ i, 0 ] );
> Ambiguous use of -i resolved as -&i() at (eval 91) line 4.
> 
> [
>  [
>   [ 0  0]
>   [ 0 -1]
>  ]
>  [
>   [0 1]
>   [0 0]
>  ]
> ]
> 
> and here is the answer i get when trying to use it ...
> pdl> p  (($z x $x) - ($x x $z))
> 
> [
>  [ 0  2]
>  [-2  0]
> ]
> 
> this should be ...
> 
> [  0  -i ]
> [  i   0 ]
> and ....
> pdl> p (($x x $y) - ($y x $x));
> 
> [
>  [
>   [ 0 -1]
>   [ 1  0]
>  ]
>  [
>   [-1  0]
>   [ 0  1]
>  ]
> ]
> 
> I have two answers for this yet the one answer should be ...
> 
> [ 1  0 ][ 0 -1 ]
> Can any one help explain why     (($x x $y) - ($y x $x)) = $z ;  (($y x $z) - 
> ($z x $y)) = $x;   (($z x $x)  -  ($x x $z)) = $y;is not working right here 
> ???
> Warm Regards,
> -Mark
> 
> 
> 

> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

> _______________________________________________
> pdl-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pdl-general


-- 

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Apdo. Postal 48-3, 62251             |                           (*)/\/  \
Cuernavaca, Morelos, México          | [email protected]   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to