Hi Luis,

ci() was introduced as part of the native-complex changes (obviously). It 
should be considered temporary for now, since the current way forward I see is 
to integrate PDL::Complex into the native stuff (since they actually appear to 
be binary-compatible, as mentioned earlier), and therefore be able to use the 
“i” constant in the same way as currently. However, are you seeing a use for it 
that adds anything to simply using i2C from PDL::Complex?

Best regards,
Ed

From: Luis Mochan<mailto:moc...@icf.unam.mx>
Sent: 07 March 2021 22:43
To: pdl-devel@lists.sourceforge.net<mailto:pdl-devel@lists.sourceforge.net>; 
perldl<mailto:pdl-gene...@lists.sourceforge.net>
Subject: Re: [Pdl-devel] PDL 2.027 released

Hello,

I'm intrigued by ci. What is the reason for its behavior?
I found that ci was defined through pp_def with one output argument.
Thus, ci+$x is interpreted as ci(+$x) which actually assigns
complex i to each element of $x if $x is a complex pdl. If $x is real,
then it assigns 0 (I guess it type-converts i though its real part).

Is there a case where you would expect a call to ci with an actual
argument? Would it be reasonable to flag an error if it is called with
a non-null argument? Would this be costly?  My guess is that ci+$x or
ci*$x would become a frequenct headache with the actual
behavior. Or maybe one can keep the current function ci and include an
actual constant
   use constant CI=>ci;
and encourage the use of the constant CI unless there is a good reason
to use ci directly.

The conversion back and forth between pairs of real numbers and
complex numbers without requiring actual multiplication with ci would
also be convenient. Given that C99 complex numbers are an array of two
reals, it might be simple.

Regards,
Luis


--

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Av. Universidad s/n CP 62210         |                           (*)/\/  \
Cuernavaca, Morelos, México          | moc...@fis.unam.mx   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB


_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

Reply via email to