RawArray.jl (or alternatives..) may be what you need, at least 
helpful/informative discussion (and looking at code, maybe telling you what 
you need to know):


On Thursday, October 13, 2016 at 6:24:27 AM UTC, Michele Zaffalon wrote:
> I need to write a 4 dimensional a array to file and use
> write(f, a).

For sure need that?

> What is the canonical binary representation of a 
> <http://docs.julialang.org/en/release-0.5/stdlib/io-network/#Base.write>? 
> It looks like the the line above is equivalent to

> Is the canonical binary representation going to be machine and OS 
> independent

Why shouldn't it be?

> (except for the endianness)? What about reshape?
> I am porting code from MATLAB and the specs for the file format are 
> defined by the MATLAB code implementation.

I'm not sure I'm answering you question, but I'm pretty sure, DenseArray s 
as packed in memory as possible (not sure if your values would be 
three-byte, if padded to 4-byte):

julia> write(STDOUT, [1 2])

julia> write(STDOUT, [0x1 0x2])

I'm pretty sure multidimensional changes nothing, you get Julia order (no 
gaps), ColumnMajor order wasn't it?

Complex numbers are a problem for some reason I didn't look into (see 
thread), that RawArray handles, but HDF5 (strangel) doesn't.

Pointers in arrays would be dangerous..

In the docs, yo point to:

You can write multiple values with the same write call. i.e. the following 
are equivalent:

write(stream, x, y...)write(stream, x) + write(stream, y...)

Is this for sure true? Not:

write(stream, x); write(stream, y...)

I like looking up directly what Julia does, e.g.:
@edit prod([]) # I do first: ENV["EDITOR"] = "vi"

in your case seems to be:
prod(f::Callable, a) = mapreduce(f, *, a)

 * Why do I find SparseArrays (only plural), that I think you do not care 
about, but DenseArray singular as expected?

help?> Sparse

Reply via email to