The Complex datyatype had been mentioned before.
I don't remember the all the details, but I recall
having been confused by the use of complex numbers. Take the following
examples:
use PDL::Complex;
$a=1+2*i;
$b=pdl(1,2);
print $a*$b;
(correctly) yields [1 +2i 2 +4i], but
$c=pdl(1+2*i, 3+4*i);
print $c*$b;
(incorrectly) yields [[1 4] [3 8]]. The problem seems to be that when
constructing $c it is interpreted as a 2x2 matrix of real numbers and
not as a 2-vector of complex numbers. This problem may be solved by
reminding pdl that $c is complex, as in
print $c->complex*$b;
or make a complex-real multiplication using the Cscale function
print Cscale($c, $b)
both of which (correctly) yield [1 +2i 6 +8i].
Thus, the current implementation yields some surprises which maybe could
be avoided by introducing a complex datatype and treating complex
numbers always as complex scalars instead of as size two real vectors,
although both points of view could be transformed into each
other. Consistency between PDL::Complex and PDL::FFTW or other
routines that use complex numbers would have to be assured.
Best regards,
Luis
ps. By the way, I ran the examples above with perlDL shell v1.354_001
and with PDL v2.4.10
On Mon, May 27, 2013 at 10:11:10AM -0400, Chris Marshall wrote:
> It appears from the response to date, that PDL
> datatypes support is fine as it is. Maybe it makes
> sense to remove that task from the list of goals
> for PDL3 this summer?
>
> Feedback welcome!
> Chris
>
>
> On Fri, May 10, 2013 at 5:01 PM, Chris Marshall <[email protected]>
> wrote:
> > All PDL Users-
> >
> >
> > We would like to add to the list of datatypes supported by
> > PDL objects.
> >
> > The list of standard C data types is not complete and it
> > doesn't covertypes from C99---especially complex numbers
> > where we've rolled ourown in a number of incompatible
> > and confusing ways.
> >
> > We would like to add more general object types as well
> > to allow forPDL to better interface with other computational,
> > data, imaging libraries by supporting arrays of structs,
> > pointers, objects...
> >
> > If you have problems where you needed a new, different, or
> > custom datatype in PDL but didn't have it, please reply with
> > specific use cases:
> >
> > - what datatype was needed
> > - description of problem
> > - implementation requirements
> > - other background
> >
> > Thanks in advance,
> > Chris
> >
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
--
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