A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://arrayfire.org/docs/group__stream__func__save.htm below:

ArrayFire: saveArray

Save an array to a binary file. More...

Save an array to a binary file.

The saveArray and readArray functions are designed to provide store and read access to arrays using files written to disk.

The format of the file (version 1) is as follows:

Header:

Description Data Type Size (Bytes) Detailed Desc Version Char 1 ArrayFire File Format Version for future use. Currently set to 1 Array Count Int 4 No. of Arrays stored in file

Per Array:

Description Data Type Size (Bytes) Detailed Desc Length of Key String Int 4 No. of characters (excluding null ending) in the key string Key Char [] length Key of the Array. Used when reading from file Offset Int64 8 No of bytes between offset and start of next array Array Type Char 1 Type corresponding to af_dtype enum Dims (4 values) Int64 4 * 8 = 32 Dimensions of the Array Data Type sizeof(Type) * dims.elements() Actual data of the array

The offset is equal to 1 byte (type) + 32 bytes (dims) + size of data.

An file with 2 arrays would look like (representative)

‍1
2
Array 1 Key Length
Array 1 Key
Array 1 Offset
Array 1 Type
Array 1 Dims
Array 1 Data
Array 2 Key Length
Array 2 Key
Array 2 Offset
Array 2 Type
Array 2 Dims
Array 2 Data

Save array allows you to append any number of Arrays to the same file using the append argument. If the append argument is false, then the contents of the file are discarded and new array is written anew.

On each append, the array counter in the header is incremented and the new array is written to the end of the file. This function does not check if the tag is unique or not.

◆ af_save_array() AFAPI af_err af_save_array ( int *  index, const char *  key, const af_array  arr, const char *  filename, const bool  append  )
Parameters
[out] index is the index location of the array in the file [in] key is an expression used as tag/key for the array during af::readArray() [in] arr is the array to be written [in] filename is the path to the location on disk [in] append is used to append to an existing file when true and create or overwrite an existing file when false
◆ saveArray() AFAPI int saveArray ( const char *  key, const arrayarr, const char *  filename, const bool  append = false  )
Parameters
[in] key is an expression used as tag/key for the array during readArray [in] arr is the array to be written [in] filename is the path to the location on disk [in] append is used to append to an existing file when true and create or overwrite an existing file when false
Returns
index of the saved array in the file

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4