Adithya -

I'm still beginning to learn how to use PP myself, but I have found
Inline::Pdlpp to be much friendlier to use than PDL::PP since it handles all
the compilation, etc, for you.  You'll need to install the Inline module
from CPAN; the Inline::Pdlpp stuff is already included with a standard PDL
install.  Once you've done that, here's a complete script that does the
sumit function:

#!/usr/bin/perl
use PDL; # must be called before (!) 'use Inline Pdlpp' calls
use Inline Pdlpp; # the actual code is in the __Pdlpp__ block below

$a = sequence 10;
print $a->sumit,"\n";

__DATA__

__Pdlpp__

   pp_def('sumit',
           Pars => 'a(n);  [o]b();',
           Code => '
                double tmp;
                tmp = 0;
                loop(n) %{
                  tmp += $a();
                %}
                $b() = tmp;
                '
           );
# end example script

Save it as a normal Perl script, set permissions, and run.  It will take a
long time to start the first time because it will have to assemble and
compile the XS code, but after that first run, as long as you don't change
the PP code, it should start up as fast as normal.  Using Inline will
hopefully help you separate out the PP code errors from the makefile errors.

Good luck.
David
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to