Skip to content

HMath.Interchange.Text

Module index · Numerical conventions

Description

Bounded ASCII numeric formats. HMath text v1 preserves dtype, shape and endian, packing values in row order; metadatapaddingNaN payload bits are binary-only. CSV/TSV are strict rectangular numeric tables, with optional quoted scalar fields, no header or comments. Matrix Market follows NIST's column-order array and one-based coordinate conventions: https://math.nist.gov/MatrixMarket/formats.html.

On this page

API Purpose
encodeText Given limits then Array, encode self-describing HMath text with dtype/shape and scalar tokens.
decodeText Given limits then HMath text bytes, parse dtypeshapetokens and return a checked Array.
encodeDelimited Given limits,comma or tab separator,then rank-two noncomplex Array, encode CSV/TSV numeric cells.
decodeDelimited Given limits,commatab separator,target DType,then CSVTSV bytes, parse rectangular real numeric cells to a rank-two Array.
encodeMatrixMarket Dense general Matrix Market; exact Int64, Float64, or Complex128.
decodeMatrixMarket Array and coordinate input, realintegercomplex/pattern fields and generalsymmetricskew-symmetric/Hermitian storage.

Documentation

encodeText

encodeText :: Limits -> Array -> Either InterchangeError ByteString Source #

Given limits then Array, encode self-describing HMath text with dtype/shape and scalar tokens. Invalid/unsupported values or output exceeding limits returns InterchangeError.

decodeText

decodeText :: Limits -> ByteString -> Either InterchangeError Array Source #

Given limits then HMath text bytes, parse dtypeshapetokens and return a checked Array. Invalid ASCIIheadervalue counts or exceeded budgets fail.

encodeDelimited

encodeDelimited :: Limits -> Char -> Array -> Either InterchangeError ByteString Source #

Given limits,comma or tab separator,then rank-two noncomplex Array, encode CSV/TSV numeric cells. No shapedtype metadata is embedded; unsupported inputseparator or output bounds fail.

decodeDelimited

decodeDelimited :: Limits -> Char -> DType -> ByteString -> Either InterchangeError Array Source #

Given limits,commatab separator,target DType,then CSVTSV bytes, parse rectangular real numeric cells to a rank-two Array. Complex dtype, malformed rows/tokens or exceeded budgets fail.

encodeMatrixMarket

encodeMatrixMarket :: Limits -> Array -> Either InterchangeError ByteString Source #

Dense general Matrix Market; exact Int64, Float64, or Complex128.

decodeMatrixMarket

decodeMatrixMarket :: Limits -> ByteString -> Either InterchangeError Array Source #

Array and coordinate input, realintegercomplex/pattern fields and generalsymmetricskew-symmetric/Hermitian storage. Coordinate duplicates are added exactly for integers and checked for finite overflow for floats. Dense output is bounded by maxElements even for sparse input.