A robust, low-level numerical matrix library for the Carp language.
- Safe & Unsafe API: Choose between performance and safety with
Result-returning functions orunsafe-variants. - True In-Place Mutation: Memory-efficient operations like
add!,sub!, andhadamard!that modify data without new allocations. - Cache-Aware Performance: Optimized matrix multiplication using transposed layouts for better cache locality.
- Zero-Copy Structural Ops: Metadata-only
reshapeandflatten(currently behaves as copy due to Carp deftype semantics, but architected for minimal overhead). - Comprehensive API: Includes
zeros,identity,random,transpose,dot,mat-vec,outer-product,approx=, and more. - Rigorous Testing: Deep verification of mathematical identities and edge cases.
Add this to your project by loading matrix.carp.
(load "path/to/carp-matrix/matrix.carp")
(use Mat)carp -x test/matrix_test.carpMIT