Thanks Luis for your help !!!
 After going over the combinations of things I think I found a way to make it 
work with 
$x = pdl([0,1],[1,0]); $z = pdl([0,(-&i)],[i,0]);$y = zeros(2,2);
$y  .=  (($z x $x) - ($x x $z));p $y 
[
 [ 1  0]
 [ 0 -1]
]
It is rather strange that i only works with a 2,2 matrix 
note try 
$w = sequence(4,4)$w .= $w*i ; 
  ## note how PDL complains below ...
PDL: PDL::Ops::assgn(a,b): Parameter 'b':
  Mismatched implicit thread dimension 0: size 2 vs. 4
There are 2 PDLs in the expression; 3 thread dims.
   PDL IN EXPR.    THREAD DIMS
   #  0 (normal):        2       4       4
   #  1 (normal):        4       4
 
.. at /usr/local/lib/x86_64-linux-gnu/perl/5.20.2/PDL/Core.pm line 810, <DATA> 
line 90.
    PDL::__ANON__(PDL=SCALAR(0x2fe0628), PDL::Complex=SCALAR(0x2fe0c50), undef) 
called at (eval 330) line 4
    main::__ANON__() called at /usr/local/bin/perldl line 719
    eval {...} called at /usr/local/bin/perldl line 719
    main::eval_and_report("\$w .= \$w*i\x{a}") called at /usr/local/bin/perldl 
line 655
    main::process_input() called at /usr/local/bin/perldl line 675
    eval {...} called at /usr/local/bin/perldl line 675

 -MarkNanoNebula
 

    On Monday, February 1, 2016 7:43 PM, 
"pdl-general-requ...@lists.sourceforge.net" 
<pdl-general-requ...@lists.sourceforge.net> wrote:
 

 Send pdl-general mailing list submissions to
    pdl-general@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
    https://lists.sourceforge.net/lists/listinfo/pdl-general
or, via email, send a message with subject or body 'help' to
    pdl-general-requ...@lists.sourceforge.net

You can reach the person managing the list at
    pdl-general-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of pdl-general digest..."


Today's Topics:

  1. Re: Pauli Matrices PDL::Complex (Luis Mochan)
  2. [moc...@fis.unam.mx: Re: Pauli Matrices PDL::Complex]
      (Luis Mochan)
  3. Re: MB::Pluggable::Fortran (Luis Mochan)
  4. Re: MB::Pluggable::Fortran (Luis Mochan)
  5. Re: MB::Pluggable::Fortran (Luis Mochan)
  6. Taint error (Luis Mochan)


----------------------------------------------------------------------

Message: 1
Date: Mon, 1 Feb 2016 18:19:46 -0600
From: Luis Mochan <moc...@fis.unam.mx>
Subject: Re: [Pdl-general] Pauli Matrices PDL::Complex
To: Mark Baker <mrbaker_...@yahoo.com>
Message-ID: <20160202001946.gh2...@yapaque.fis.unam.mx>
Content-Type: text/plain; charset=iso-8859-1


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
> pdl-general@lists.sourceforge.net
> 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          | moc...@fis.unam.mx  /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB





------------------------------

Message: 2
Date: Mon, 1 Feb 2016 18:24:22 -0600
From: Luis Mochan <moc...@fis.unam.mx>
Subject: [Pdl-general] [moc...@fis.unam.mx: Re: Pauli Matrices
    PDL::Complex]
To: perldl <pdl-general@lists.sourceforge.net>
Message-ID: <20160202002422.gj2...@yapaque.fis.unam.mx>
Content-Type: text/plain; charset=iso-8859-1

(Sorry if this is a duplicate; I made a mistake with mutt)


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
> pdl-general@lists.sourceforge.net
> 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          | moc...@fis.unam.mx  /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB



----- End forwarded message -----

-- 

                                                                  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          | moc...@fis.unam.mx  /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB





------------------------------

Message: 3
Date: Mon, 1 Feb 2016 18:55:17 -0600
From: Luis Mochan <moc...@fis.unam.mx>
Subject: Re: [Pdl-general] MB::Pluggable::Fortran
To: "Mark Grimes." <mgri...@cpan.org>,    perldl
    <pdl-general@lists.sourceforge.net>
Message-ID: <20160202005517.gf2...@yapaque.fis.unam.mx>
Content-Type: text/plain; charset=iso-8859-1


Mark,

I started to test my modules, built with
Module::Build::Pluggable::Fortran and Module::Build::Pluggable::PDL.
So far './Build test' works, but './Build disttest' fails. One of the many
reasons is the following error
  #    Tried to use 'P::E'.
  #    Error:  Can't locate loadable object for module
  lib::P::E in @INC
(I simplified the name above). After I get this error, './Build test'
fails for the same reason, although this can be cured by a './Build
clean'.  Trying to understand the error, I made a distribution, i.e.,
'./Build dist' and looked at teh contents of the .tar.gz generated
file. I realized that the source of the module P::E was absent, i.e.,
the file P::E.pd which contains the calls to my fortran routines was
not copied, and thus, the corresponding libraries were not built when
testing the distribution.

Do you have any advice?

Regards,
Luis




On Thu, Jan 28, 2016 at 06:31:55PM -0600, Luis Mochan wrote:
> I noticed that MB::Pluggable::Fortran cleans the file f77_underscore,
> although that file is not generated during the build process. However
> that file is generated, for example, in the build process of
> PDL::Slatec as a hack to find out if Fortran routine names ought to be
> followed by an underscore when called from a .pd file. I had copied
> the relevant code from the Makedfile of PDL::Slatec to my Build.PL
> file and it did work properly, except for an inconvenience. When I
> './Build clean', that file disappears, so if I './Build' again without
> running 'perl Build.PL' first, my underscores dissapear from the calls
> to my Fortran routines and they can no longer be linked to my PDL
> code. Thus I guess that the file f77_underscore should be rebuilt every time 
> I './Build' my
> package, and not only when 'Build' is created. To that end I made a
> further change to my MB::Pluggable::Fortran.pm routine, adding the
> appropriate code from PDL::Slatec's Makefile.PL to the sub routine
> HOOK_build. I attach a patch. So far, it seems to work.
> 
> Best regards,
> Luis
> 
> 
> 
> On Wed, Jan 27, 2016 at 08:49:23AM -0600, Luis Mochan wrote:
> > Hello Mark,
> > Thank you! The module is simplifying the preparation of my packages,
> > and seems to be working nicely now.
> > Best regards,
> > Luis
> 
> -- 
> 
>                                                                  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          | moc...@fis.unam.mx  /\_/\__/
> GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB
> 
> 

> *** Fortran.pm    2016-01-28 18:10:47.703398767 -0600
> --- 
> /home/mochan/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.1/Module/Build/Pluggable/Fortran.pm
>     2016-01-28 18:29:56.022810851 -0600
> ***************
> *** 46,51 ****
> --- 46,59 ----
>  
>      my $mycompiler = ExtUtils::F77->compiler();
>      my $mycflags  = ExtUtils::F77->cflags();
> +    #Find if we need trailing underscores in fortran
> +    #if we do, create a notice which may be used by .pd files later on.
> +    my $trail = ExtUtils::F77->trail_;
> +    unlink("f77_underscore") if -e "f77_underscore";
> +    if ($trail) {
> +     open OUT, ">f77_underscore" or die "unable to write scratch file";
> +     close OUT;
> +    }
>      undef $mycflags if $mycflags =~ m{^\s*};    # Avoid empty arg in cmd
>  
>      my $f_src_files = $self->_fortran_files;

> ------------------------------------------------------------------------------
> 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
> pdl-general@lists.sourceforge.net
> 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          | moc...@fis.unam.mx  /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB





------------------------------

Message: 4
Date: Mon, 1 Feb 2016 19:03:19 -0600
From: Luis Mochan <moc...@fis.unam.mx>
Subject: Re: [Pdl-general] MB::Pluggable::Fortran
To: "Mark Grimes." <mgri...@cpan.org>,    perldl
    <pdl-general@lists.sourceforge.net>
Message-ID: <20160202010319.gk2...@yapaque.fis.unam.mx>
Content-Type: text/plain; charset=us-ascii

Sorry,
I believe now that that error was trivial: I had forgotten to add the
.pd file to the MANIFEST.
Regards,
Luis



On Mon, Feb 01, 2016 at 06:55:17PM -0600, Luis Mochan wrote:
> 
> Mark,
> 
> I started to test my modules, built with
> Module::Build::Pluggable::Fortran and Module::Build::Pluggable::PDL.
> So far './Build test' works, but './Build disttest' fails. One of the many
> ...



------------------------------

Message: 5
Date: Mon, 1 Feb 2016 19:21:07 -0600
From: Luis Mochan <moc...@fis.unam.mx>
Subject: Re: [Pdl-general] MB::Pluggable::Fortran
To: "Mark Grimes." <mgri...@cpan.org>
Cc: perldl <pdl-general@lists.sourceforge.net>
Message-ID: <20160202012107.gl2...@yapaque.fis.unam.mx>
Content-Type: text/plain; charset=iso-8859-1

Hi Mark,
> ...over zealous in my cleanup. If we just remove the following line, does
> that solve the issue you're seeing?
> 
>  38:  $self->builder->add_to_cleanup('f77_underscore');
> 
I guess it is better to clean it up, as it would only be required
during the build process. I don't know if it is useful or not, as I
don't know if there is any relevant fortran compiler that doesn't use
the underscore to name its routines. I'm using it as I saw that PDL
used it in its Slatec module.

Regards,
Luis



> Thanks,
> Mark
> 
> On Thu, Jan 28, 2016 at 7:31 PM, Luis Mochan <moc...@fis.unam.mx> wrote:
> > I noticed that MB::Pluggable::Fortran cleans the file f77_underscore,
> > although that file is not generated during the build process. However
> > that file is generated, for example, in the build process of
> > PDL::Slatec as a hack to find out if Fortran routine names ought to be
> > followed by an underscore when called from a .pd file. I had copied
> > the relevant code from the Makedfile of PDL::Slatec to my Build.PL
> > file and it did work properly, except for an inconvenience. When I
> > './Build clean', that file disappears, so if I './Build' again without
> > running 'perl Build.PL' first, my underscores dissapear from the calls
> > to my Fortran routines and they can no longer be linked to my PDL
> > code. Thus I guess that the file f77_underscore should be rebuilt every 
> > time I './Build' my
> > package, and not only when 'Build' is created. To that end I made a
> > further change to my MB::Pluggable::Fortran.pm routine, adding the
> > appropriate code from PDL::Slatec's Makefile.PL to the sub routine
> > HOOK_build. I attach a patch. So far, it seems to work.
> >
> > Best regards,
> > Luis
> >
> >
> >
> > On Wed, Jan 27, 2016 at 08:49:23AM -0600, Luis Mochan wrote:
> >> Hello Mark,
> >> Thank you! The module is simplifying the preparation of my packages,
> >> and seems to be working nicely now.
> >> Best regards,
> >> Luis
> >
> > --
> >
> >                                                                  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          | moc...@fis.unam.mx  /\_/\__/
> > GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB
> >
> >
> 

-- 

                                                                  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          | moc...@fis.unam.mx  /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB





------------------------------

Message: 6
Date: Mon, 1 Feb 2016 20:43:02 -0600
From: Luis Mochan <moc...@fis.unam.mx>
Subject: [Pdl-general] Taint error
To: pdl-general@lists.sourceforge.net
Message-ID: <20160202024302.gm2...@yapaque.fis.unam.mx>
Content-Type: text/plain; charset=iso-8859-1

While testing a distribution I got the error report
    Error:  Insecure $ENV{PATH} while running with -T switch at 
.../5.22.0/x86_64-linux/PDL/IO/Pic.pm line 19...
so it seems that PDL::IO::Pic should untaint the environment to be safe.

Regards,
Luis





-- 

                                                                  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          | moc...@fis.unam.mx  /\_/\__/
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
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general


End of pdl-general Digest, Vol 13, Issue 2
******************************************


  
------------------------------------------------------------------------------
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=272487151&iu=/4140
_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to