Converting between PDL::Complex and native is still on the to-do list. What 
your expression created there is a PDL::Complex (which is a thin layer over a 
PDL with an extra dim of 2) whose underlying numbers were native complex 
numbers, hence your output. That would be straightforward enough to detect and 
allow for. Want to open an issue and/or a PR with just a test case (in 
t/complex.t please)? 😊

More broadly, interoperability between the two is conceptually a bit tricky, 
because of the dimensions thing, which was kind of the motivation for 
implementing this in the first place. As you know, I plan to allow the virtual 
slice of ā€œreā€ and ā€œimā€ with dataflow, but because that’s quite hard I haven’t 
started it yet (I’m learning more about PDL and complex numbers by converting 
Photonic to using the native stuff). I am open to ideas!

By the way, folks who’ve kindly PR-ed stuff in the past from their own GitHub 
forks: could I ask you to delete branches that aren’t yours (such as indexops)? 
It’s very easy to do in the web UI (the trashcan icon on the ā€œBranchesā€ list) 
and makes things tidier for me when I’m pulling your branches to my local repo 
(if I want to bring your work up to date before merging it, for instance).

From: Luis Mochan<mailto:moc...@icf.unam.mx>
Sent: 03 April 2021 20:07
To: pdl-devel@lists.sourceforge.net<mailto:pdl-devel@lists.sourceforge.net>
Subject: [Pdl-devel] complex numbers

Trying to find out how safe is it to mix different types of complex
numbers (for migration purposes), I tried:

    pdl> use PDL::Complex
    pdl> print i*ci()
    0+0i +0+1ii

So, I guess not surprisingly, that they are not. I don't know if these
mixed operations should be forbidden (I guess it would be the easiest
course) or if PDL::Complex'es should be promoted to native complexes
before the operation or the other way around.

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

Reply via email to