On Thu, Dec 13, 2012 at 4:46 AM, Konrad Hinsen
<[email protected]> wrote:
> --On 12 décembre 2012 11:28:31 -0500 Raul Miller <[email protected]>
> wrote:
>> On Wed, Dec 12, 2012 at 10:55 AM, Konrad Hinsen
>> <[email protected]> wrote:
>>> My personal dream would be a J implementation that uses NumPy arrays
>>> internally, letting me combine Python and J easily.
>>
>> Why not the other way around?
>>
>> Since NumPy's design is about incorporating externally defined types,
>> why not make it support J's types?
>
> My data comes in through C libraries interfaced to NumPy, so my starting
> point for any computation is a NumPy array. If I can get away with not
> copying it to something else, that would be the best solution for me.
Copying is an easy operation, and if you are doing any significant
work the cost of a copy is often trivial when compared with everything
else you are doing.
> I don't know how J arrays are stored internally. Perhaps one could have both
> NumPy and J arrays share the same memory space for the raw data. That would
> be a nice solution as well.
The result of 3!:1 is very close to the internal representation. That
said, if you look in jtype.j in the j source, you'll see this:
:typedef struct {I k,flag,m,t,c,n,r,s[1];}* A;
along other supporting declarations (note especially the section
marked "Fields of type A") -- that's the internal representation of
J's arrays.
FYI,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm