// ---
// tags: trop, source
// crystal-type: source
// crystal-domain: comp
// ---
//! Binary encoding for tropical elements and matrices.
//!
//! All values are encoded as little-endian u64.
use crateTropical;
use crateTropMatrix;
/// Decode 8 bytes (little-endian) into a tropical element.
/// Encode a tropical element as 8 bytes (little-endian).
/// Decode a byte slice into an n x n tropical matrix.
///
/// The slice must contain exactly `n * n * 8` bytes, where each consecutive
/// 8-byte chunk is a little-endian u64 in row-major order.
///
/// # Panics
/// Panics if the slice length does not match `n * n * 8`.
/// Serialize an n x n tropical matrix to bytes (little-endian, row-major).
///
/// Returns a vector of `n * n * 8` bytes. Since we are `no_std`, this
/// writes into a caller-provided buffer.
///
/// # Panics
/// Panics if `buf.len() < n * n * 8`.
trop/rs/src/encoding.rs
ฯ 0.0%