Hi folks,

I added the warning because I found the behaviour surprising when adding tests. 
My plan now is that ci() will go away, so my proposal is to use it as “ci()” 
for now, bearing in mind it’s only temporary. How does that sound? Sorry about 
the API change. If we had a proper bit in the docs about handling of complex 
numbers, I’d have added a warning that it should be considered experimental and 
subject to change. If anyone has ideas about the best location for such docs, 
please say :-)

By the way, there is a PDL 2.028_01 that’s intended to fix a few remaining 
gremlins in native-complex on older (and buggy/incomplete) libm’s on FreeBSD 
and CentOS, together with some updates I’ve incorporated out of the PDLA 
distros. If it tests Ok, I’ll be full-releasing 2.029 quite soon, then looking 
at the PDL::Complex integration.

Best regards,
Ed

From: Luis Mochan<mailto:moc...@icf.unam.mx>
Sent: 08 March 2021 15:15
To: pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net>
Subject: Re: [Pdl-general] [Pdl-devel] PDL 2.027 released

Hi Ingo,

On Mon, Mar 08, 2021 at 03:35:36PM +0100, Ingo Schmid wrote:
> ...

> Now, looking into PDL::Ops you will see this warning:
>
>  Returns the complex number 0 + 1i.
>
> B<WARNING> because this is not defined as a constant (with empty
>  prototype), you must use it either as C<10*ci> or C<ci()*10>. If you
>  use it as C<ci*10> this will actually try to use 10 as a glob and pass
>  that to C<ci>, which will not do what you want.

Yes, I saw the warning. Nevertheless, having $x+ci!=$ci+$x would
surprise many. For this reason, I guess it would be a good idea in the
meantime, before the merge with PDL::Complex mentioned by Ed, to give
an explicit error or warning message whenever ci is called, most
probably inadvertently, with an actual non-null argument, or else, to promote
the use of a 'true' constant (maybe CI), similar to the 'i' of
PDL::Complex,  instead of the function ci.

Would
    use constant CI=>ci; # or sub CI () {state $i=ci; return $i;}
    my $z=$x+$y*CI; # ==$x+CI*$y
be more expensive than
    my $z=$x+$y*ci; # !=$x+ci*$x
?
If not, then the current ci could be hidden from the users and CI above
exported (maybe with a better choice of names).

Best regards,
Luis
_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to