My 2 cents, this should not be part of the J engine, but implemented as a
library.
It appears that NumPy itself implements .npy conversion as a library:
https://github.com/numpy/numpy/blob/master/numpy/lib/format.py

On Fri, Sep 25, 2020 at 8:41 PM bill lam <[email protected]> wrote:

> An easier approach would be writing a thin wrapper for an existing c shared
> library and then use 15!:0 to call the wrapper.
>
> Unless the npy has at least become as widely used as json, I don't think it
> should be included inside J engine.
>
>
>
> On Fri, Sep 25, 2020, 4:51 AM 'Zhihao Yuan' via Source <
> [email protected]>
> wrote:
>
> > On Thu, Sep 24, 2020 at 12:44 PM Eric Iverson <[email protected]>
> > wrote:
> >
> > >
> > > It should be possible to package it as an addon. The addon would
> include
> > > shared libraries for the platforms of interest (windows/linux/macos)
> and
> > > simple cover functions that did the cd calls to the libraries. This is
> > how
> > > Jd/lapack/etc provide extensions like this.
> >
> >
> > You are essentially asking me to write a
> > new library in C, since there is no such
> > library from the beginning -- which may
> > be fine.  But here are the problems I
> > encountered:
> >
> > 1. How do I allocate a J array before
> > knowing its type and shape?  Because
> > DLL (15!:) interface wants J side to pass
> > such a thing into cd.  The short answer is
> > I can't.  I must use separated calls to
> > negotiate the type and shape, which
> > leads to the next question...
> >
> > 2. How to pass FILE* to DLL from J?
> > All I can access from J code is file number;
> > DLL doesn't know what that is.  This implies
> > that I may have to pass only filenames and
> > open a file twice -- first to parse its header,
> > then to load its data. But there is no
> > guarantee that the file is not renamed
> > between the two calls, or corresponds to
> > the same file.  From a C library's point of
> > view, such an API will be poorly designed.
> >
> > I'm leaning towards adding this
> > functionality as 3!:12 and 3!:13, converting
> > a J array to bytes in NPYand retrieving a
> > J array from bytes.
> >
> > --
> > Zhihao
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to