consistency API

Luna-Flow/linear-algebra/consistency is a test-only package. It has no public items: its interface file is empty, and it exists to run cross-package agreement tests between immut, mutable and immut.MatrixFn.

Source: src/consistency/core_wbtest.mbt. What is compared and why is explained in the consistency design.

Public items

None. The package is not meant to be imported.

Test suite

TestWhat must agree
matrix core operations stay alignedstorage order, +, *, transpose, trace of immut and mutable
matrix constructors and conversions stay alignedmake, new, from_2d_array, from_array, to_2d_array, degenerate shapes
matrix and vector conversions stay alignedrow, column and diagonal matrices from vectors
semantic differences stay explicitthe documented differences (in-place versus returned updates)
shared same_index_swap stays alignedswap_rows(i, i) and swap_cols(i, i) are no-ops in both
identity and transpose laws stay alignedAI=AAI = A, IA=AIA = A, (AB)T=BTAT(AB)^{\mathsf T} = B^{\mathsf T} A^{\mathsf T}
trace and multiplication associativity stay alignedtr⁡(AT)=tr⁡(A)\operatorname{tr}(A^{\mathsf T}) = \operatorname{tr}(A), (AB)C=A(BC)(AB)C = A(BC)
vector tensor and matrix conversion laws stay alignedouter products, row and column matrices
cross-package matrix semiring laws on small integersquickcheck: associativity of +, distributivity, equal products
zero-column multiplication stays aligned(2×0)(0×0)(2 \times 0)(0 \times 0) products
immut and fn_matrix stay aligned on core lawsMatrix versus MatrixFn for +, transpose, determinant, pow
all matrix implementations stay aligned under random small inputsquickcheck: all three implementations on random 2×22 \times 2 inputs

Run it with:

moon test -p consistency