HMath.Interchange.Numpy¶
Module index · Numerical conventions
Description
NPY v1v2v3 and NPZ (ZIP32 directory, stored or raw-DEFLATE members). Scalar fixed-width dtypes only: object/pickle, records, strings and ZIP64 directories are rejected. NumPy's small-file ZIP64 local headers are accepted. Input budgets cover aggregate uncompressed bytes. Nothing is extracted to disk, so archive names can never become filesystem paths. Specifications: https://numpy.org/doc/stable/reference/generated/numpy.lib.format.html and https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT.
On this page¶
| API | Purpose |
|---|---|
| encodeNpy | Given limits,physical C/F order,then Array, repack and write a NumPy NPY v1 payload with explicit dtypeendianshape. |
| decodeNpy | Given limits then NPY bytes, decode supported v1v2v3 fixed-width scalar dtype arrays. |
| encodeNpz | Deterministic archives, DOS epoch timestamps and no ZIP comments. |
| decodeNpz | Checks directory/local consistency, CRC, exact deflate length, duplicate names, overlapping member ranges and aggregate expanded bytes. |
Documentation
encodeNpy
encodeNpy :: Limits -> Order -> Array -> Either InterchangeError ByteString Source #
Given limits,physical C/F order,then Array, repack and write a NumPy NPY v1 payload with explicit dtypeendianshape. Oversized header/output or unsupported layout conversion fails.
decodeNpy
decodeNpy :: Limits -> ByteString -> Either InterchangeError Array Source #
Given limits then NPY bytes, decode supported v1v2v3 fixed-width scalar dtype arrays. Reject pickleobjectrecordstring dtypes, malformed headers, unknown endianlayout, trailing bytes or exceeded budgets.
encodeNpz
encodeNpz :: Limits -> Bool -> [(String, Array)] -> IO (Either InterchangeError ByteString) Source #
Deterministic archives, DOS epoch timestamps and no ZIP comments. True selects raw DEFLATE and requires the optional zlib build feature.
decodeNpz
decodeNpz :: Limits -> ByteString -> IO (Either InterchangeError [(String, Array)]) Source #
Checks directory/local consistency, CRC, exact deflate length, duplicate names, overlapping member ranges and aggregate expanded bytes. Data descriptorsencryptionmulti-disk/ZIP64 directories are explicitly rejected.