I tested the constructor pdl instead of cat:
pdl> use PDL::Complex
pdl> p pdl(pdl(1),pdl(2*i))
[
[1 0]
[0 2]
]
This seems correct, although the result is not interpreted as a vector
of complex numbers,
pdl> p pdl(pdl(1),pdl(2*i))->cplx
[1 +0i 0 +2i]
but that is easily recovered.
pdl> p pdl(pdl(1),pdl(0,2))
[
[1 0]
[0 2]
]
pdl> p pdl(pdl(1),pdl(0,2))->cplx
[1 +0i 0 +2i]
pdl>
So it seems the constructor does indeed the 'Right Thing'.
Thanks again,
Luis
On Sat, Mar 09, 2013 at 08:11:12PM -0600, David Mertens wrote:
> Luis -
>
> I remember putting a lot of effort a few years ago into getting cat to do
> the right thing for a number of scenarios, and to report the right error
> when things failed. Over the course of this, I realized that you can use
> pdl() to concatenate stuff in a way that more forgiving and which almost
> always Does What You Mean. Because it is more relaxed, I recommend using it
> instead of using cat unless you explicitly want the dimension checks that
> cat is supposed to provide.
>
> That said, ironing out these issues with cat is a Good Thing. :-)
>
> David
>
>
> On Sat, Mar 9, 2013 at 11:51 AM, Craig DeForest
> <[email protected]>wrote:
>
> > I would have to check, since I haven't used the complex code in donkey's
> > years. The current git should give the same answer as glue. The
> > constructor itself should do the Right thing - e.g. pdl(pdl(1),pdl(2*i)) -
> > since it zero-pads short elements in its arg list.
> >
> > (Mobile)
> >
> >
> > On Mar 9, 2013, at 10:38 AM, Luis Mochan <[email protected]> wrote:
> >
> > >> Thanks for the report -- fixed in git.
> > > Thanks for fixing it so promptly!
> > >
> > > I haven't tried the new git version, but I found a related bug and a
> > surprise:
> > > pdl> use PDL::Complex
> > > pdl> p cat(pdl(1),pdl(2*i))
> > > [1 2]
> > > I guess this is the same bug as before.
> > > pdl> p cat(pdl(2*i), pdl(1))
> > > [0 +2i 1 +1i]
> > > This may be suprising, as it might be expected that the real number
> > > pdl(1) gets complexified to 1+0*i, but actually, the threading machine
> > adds a
> > > dummy dimension that converts pdl(1) to the vector [1,1] which is
> > > interpreted as 1+1i. The relation between complex numbers and size 2
> > > vectors has to be handled with care. What would the result of
> > > cat(pdl(1),pdl(2*i)) using the current git version? [1+1i,0+2i] or
> > > [1+0i,0,2i]?
> > >
> > > Best regards,
> > > Luis
> > >
> > > _______________________________________________
> > > Perldl mailing list
> > > [email protected]
> > > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> > >
> >
> > _______________________________________________
> > Perldl mailing list
> > [email protected]
> > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> >
>
>
>
> --
> "Debugging is twice as hard as writing the code in the first place.
> Therefore, if you write the code as cleverly as possible, you are,
> by definition, not smart enough to debug it." -- Brian Kernighan
--
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: DD344B85, 2ADC B65A 5499 C2D3 4A3B 93F3 AE20 0F5E DD34 4B85
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl