I have a further question that may be helpful for others that are using
the PDL API with libraries like R, Eigen, Armadillo, etc.:

R stores data in column-major order, while PDL blocks are stored in
row-major order. I know that there exists PDL::Matrix for column-major
access from Perl, but I don't know if there is a recommended way to do
the same from C.

It would be very cool if a role-like interface could handle the
different matrix layouts and other features:
    PDL->new( ...,  with => [qw( ColumnMajor Factor ) ] );

Cheers,
- Zaki Mughal

On 2014-09-24 at 23:21:29 -0500, Zakariyya Mughal wrote:
> On 2014-09-24 at 07:41:20 -0400, David Mertens wrote:
> > Zaki,
> > 
> > If R's dataframes pack data in contiguous chunks of memory, then you simply
> > need to write an XS function that assigns the piddle's data pointer to the
> > the dataframe's starting point in memory. Documentation for doing this is
> > in PDL::API <http://pdl.perl.org/?docs=API&title=PDL::API>. Working
> > examples that I know of include PDL::Parallel::threads
> > <https://github.com/run4flat/PDL-Parallel-threads/blob/master/lib/PDL/Parallel/threads.xs#L66>
> > and PDL::Graphics::PLplot
> > <https://metacpan.org/source/DHUNT/PDL-Graphics-PLplot-0.67/plplot.pd#L3811>
> > .
> 
> Hi David,
> 
> Thanks for the heads up. Reading these is really useful.
> 
> I have started working on interfacing with R.
> I'm experimenting with R's API here
> <https://github.com/zmughal/embedding-r-in-perl-experiment>, but I
> haven't incorporated the PDL flags yet.
> 
> I've been *really* busy lately, so I don't know when I'll get to
> finishing it. Hopefully I'll get a spark of inspiration. ;-)
> 
> Cheers,
> - Zaki Mughal
> 
> P.S. I'm looking into that Octave parser for MATLAB, but I need to
> figure out how to use Octave's C++ classes from Perl. They seem a bit
> too complex for Inline::CPP, but I honestly haven't tried very hard to
> make it work.
> 
> > 
> > David
> > 

_______________________________________________
Perldl mailing list
Perldl@jach.hawaii.edu
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to