Does this help?

   tmp=. 1p1 $~ NX,NY
   (3!:1 tmp) fwrite '\Temp\Tmpv'  NB. Internal representation
824
NB. 824= 24 (array header)+*/8,NX,NY  NB. bytes/float, rows, columns
   JCHAR map_jmf_ 'abc';'\Temp\Tmpv'
   $3!:2 abc        NB. Convert to J var
10 10
   tmp-:3!:2 abc
1

I have details on how to figure out the internal representation, which would
let you calculate the size, in a paper I'll try to dig up.

The size of 1024 returned by 7!:5 probably rounds up for word alignment or
something like that.

On Tue, Jun 16, 2009 at 5:54 AM, Matthew Brand <[email protected]>wrote:

> What is the formula for calculating the number of bytes to
> createjmf_jmf_ a file for mapping for a pre-known sized array of a
> given type?
>
>   require 'jmf'
>   NX =. 10
>   NY =. 10
>   nbytes=: 7!:5 <'tmp' [ tmp=. 1p1 $~ NX,NY  NB. my estimate of
> number of bytes for  10x10 array of floats
>   createjmf_jmf_ '/tmp/tmp';nbytes
>   (JFL;NX) map_jmf_ 'tmp';'/tmp/tmp'
>   ](NX,NY) NB. the shape I want
> 10 10
>   ]$ tmp NB. not the shape I wanted
> 19 10
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to