Idx File ((exclusive))

Idx File ((exclusive))

# Write dimensions (big-endian) for dim in data_array.shape: f.write(dim.to_bytes(4, 'big'))

: When you include the \makeindex command in a LaTeX document, the software generates a .idx file containing all the entries you've tagged with \index commands. idx file

int idx_read(const char *filename, idx_file_t *out) FILE *f = fopen(filename, "rb"); if (!f) return -1; # Write dimensions (big-endian) for dim in data_array

data_type_code = magic[2] dim_count = magic[3] idx_file_t *out) FILE *f = fopen(filename

| Operation | Python (struct+numpy) | C (libidx) | NumPy .npy | HDF5 | |-----------|----------------------|------------|--------------|------| | Load 60k images | 0.24 sec | 0.09 sec | 0.19 sec | 0.31 sec | | Memory mapping | N/A | 0.001 sec | 0.001 sec | 0.15 sec | | Random access (per image) | 2.1 µs | 0.4 µs | 1.2 µs | 8.5 µs |

| File content | Magic (hex) | Magic (bytes) | Type | Dims | |--------------|-------------|---------------|------|------| | MNIST images | 0x00000803 | 00 00 08 03 | uint8 | 3 | | MNIST labels | 0x00000801 | 00 00 08 01 | uint8 | 1 | | 3D float volume | 0x00000D03 | 00 00 0D 03 | float32 | 3 | | 2D double matrix | 0x00000E02 | 00 00 0E 02 | float64 | 2 |