Such binary files consist of two records: description whose length is 32 bytes and data whose length is determined by the description. The rest of the bytes are of special use described below or ignored.
Description record consists of four groups of bytes:
list(integer)whose format is determined by the code
Format identifier for version 1 is equal to 1760568055 and is unique with alternative byte orderings taken into account (-148705176).
Format code consists of 4 bytes defined as follows:
The dimensions list depends on the shape:
[n]gives its size
n/mis the row/column dimension
[n]gives the number of rows or columns (it is square)
[n1,n2,n3,...]gives the array dimensions
Additional bytes are used as follows:
list(byte)describes datatypes for the list elements: 0/128+1,2,4,8 means integer/float of size 1,2,4,8
Finally, data record gives the elements one by one in the order prescribed by the shape. For shape 13, vector of varying dimensions (described by code) is followed by linearized records corresponding to the fixed secondary dimension.
elements: =-522.788480, sum=-1086.285092
elements: [1,1]=0.000047, [2,1]=-0.000188, [1,2]=0.000218, sum=19.433223
elements: [1,1]=1.000000, [1,2]=[2,1]=0.219059, [2,2]=1.000000, sum=66.308944