J can handle opengl and lapack2 without source updates -- it seems
like it shouldn't need to be patched to deal with npy.

This should be implementable in native J (using the same 15!: foreigns
used for opengl) for example, as a github addon. (And, when it's good
enough, a pull request to make it visible in the package manager
interface.)

That said -- if any of this isn't documented adequately, this should
also be seen as an opportunity to raise those issues, so the community
can improve the documentation.

-- 
Raul

On Thu, Sep 24, 2020 at 12:06 PM 'Zhihao Yuan' via Source
<[email protected]> wrote:
>
> NPY is a popular lightweight binary format
> for exchanging multidimensional arrays.
>
>   https://numpy.org/doc/stable/reference/generated/numpy.lib.format.html
>
> NumPy introduced it, and now it gains support
> in the NumPy ecosystem. It gains support in
> other languages, too, such as C++ (via xtensor-io).
>
> This patch proposes a new foreign, 128!:9. Its
> dyad form writes a J array to a npy file,
>
> x 128!:9 '1d'
> (returns a boxed full path to 1d.npy)
>
> and its monad form can read it back
>
> x =: 128!:9 '1d'
>
> An atom array is treated as zero-dimension
> NumPy array. The data types are supported
> with best efforts.
>
> SimpleRose Inc crafted this patch and would
> like to contribute it to J, so that J can exchange
> data with NumPy/Python in binary, without
> losing a bit of precision.
>
> About the patch: To parse npy headers
> correctly, the patch uses a PEG parser
> generated with PackCC.
>
> --
> 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

Reply via email to