Algebra.MatrixDense matrix algebra parameterized over a semiring.
Matrices are stored row-major in a flat s array. All arithmetic uses the semiring operations (⊕ and ⊗) rather than field operations, so this module works over any Semiring.T, including Boolean, tropical, and bottleneck semirings.