Ramda-based library for working with matrices in JavaScript
Install this package:
npm i ramda-matrix
Import the library into your script:
import * as M from 'ramda-matrix';
Start hacking!
const A = M.parse`
1 2/3 3
-1 2 3
`;
console.table(M.matrixByMatrix(A,A));
Documentation is located in src/index.ts
- Strongly-typed (TypeScript)
- Purely functional
- Every function is curried
- Tiny bundle size
- Support for most common linear algebra functions and utilities:
- parse a matrix from a string (
parse
) - add/subtract two matrices (
sum
,diff
) - transpose (
transpose
) - multiply matrix by a scalar/vector/matrix(
matrixByScalar
,matrixByVector
,matrixByMatrix
) - compare matrices (
equal
,isIdentity
) - generating matrices (
identity
,traverse
,fill
)
- parse a matrix from a string (
NOTE: you can print any matrix by calling console.table
:
console.table(A);
NOTE: JavaScript is infamous for floating point rounding errors. Most of them can be metigated by rounding each cell, like this:
parseInt(cell.toFixed("3"))
Status indicators:
- (
b
) signifies a breaking change - (
i
) signifies change of behaviour for existing functions
- Fix a bug with
parse
returning NaN when line contains whitespaces at the beginning (i
)
- Add a
markowChain
function - Add a
rotationMatrix
function - Improve documentation
- Make
parse
support floating-point numbers and fractions (i
) - Improve documentation
- Make function names more consistent (
b
) - Remove
rotate
function (b
)
- Initial release
- Add functions for elementary matrix operations
- Make
det
work with any matrix - Add a
rref
function - Add an
inverse
function - Add a
rotate
function - Add a
reflect
function? - Make
identity
accept single argument