The PDL::atan2 can be cleaned up by using a PMCode section for the function definition. However, the general issue with atan2 cannot, AFAICT. Here's an example from the Perl debugger REPL:
-----------%<----------- > perl -d -e 1 Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 1 DB<1> p atan2(1,2) 0.463647609000806 DB<2> @b = (1,2) DB<3> p atan2(@b) Not enough arguments for atan2 at (eval 10)[/usr/share/perl/5.10/ perl5db.pl:638] line 2, near "@b)" -----------%<----------- That means that perl's atan2 has a signature that *requires* two scalars. I don't think we can do anything to fix that. David On Tue, Jan 24, 2012 at 8:15 AM, Chris Marshall <[email protected]>wrote: > Maybe this could be fixed for PDL-2.4.11 or PDL-2.5? > I wonder how common it is and what the reason for that > in the implementation. > > --Chris > > > On Mon, Jan 23, 2012 at 7:43 PM, chm <[email protected]> wrote: > > On 1/23/2012 6:12 PM, David Mertens wrote: > >> > >> On Mon, Jan 23, 2012 at 3:35 PM, Chris > >> Marshall<[email protected]>wrote: > >> > >>> I was trying to calculate atan2() of a [2,N] pdl > >>> and got the following error: > >>> > >>> pdl> p $allind->shape > >>> [2 40] > >>> > >>> pdl> p atan2($allind->using(0,1)) > >>> Compile error: Not enough arguments for atan2 at (eval 495) line 7, > near > >>> ")) > >>> > >>> " > >>> BEGIN not safe after errors--compilation aborted at (eval 495) line 7. > >>> > >>> The problem is that the prototype for atan2() appears to > >>> require two piddle arguments, specifically. Does anyone > >>> know if there is a way to make the above work or is > >>> this a restriction of the current PDL implementation? > >>> > >>> Thanks, > >>> Chris > >>> > >> > >> Wow, that's a toughy. However, reading the docs, I see this: > >> > >> Note that when calling this function explicitly you need to supply a > third > >> argument that should generally be zero (see first example). This > >> restriction is expected to go away in future releases. > >> > >> So, you could call it like so (note the trailing zero): > >> > >> PDL::atan2($a->using(0,1), 0) > > > > > > Very mysterious...thanks for the fix. --Chris > -- Sent via my carrier pigeon.
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
