SassyMatrix 
All you ever wanted to deal with matrices in Sass.
What's in there?
Instanciating matrix
matrix($x, $y: $x): create a matrix of$xrows by$ycolumns filled with 0sunit-matrix($x, $y): create a matrix of$xrows by$ycolumns filled with 0s except the diagonal which is filled with 1s
Writing in matrix
set-entry($matrix, $coords, $value): set$valueat$matrix[$coords[1], $coords[2]]set-column($matrix, $index, $column: ()): set$columnat$indexin$matrixset-row($matrix, $index, $row: ()): set$rowat$indexin$matrixadd-column($matrix, $column: (), $index: null): add$columnat$indexin$matrixadd-row($matrix, $row: (), $index: null): add$rowat$indexin$matrix
Reading matrix
get-entry($matrix, $coords): get entry at$matrix[$coords[1], $coords[2]]get-column($matrix, $index): get column at$indexfrom$matrixget-row($matrix, $index): get row at$indexfrom$matrix
Displaying matrix
display($matrix): display matrix
Altering matrix
swap-entries($matrix, $e1, $e2): swaps values$e1and$e2from$matrixswap-rows($matrix, $r1, $r2): swaps rows$r1and$r2from$matrixswap-columns($matrix, $c1, $c2): swaps columns$c1and$c2from$matrixtranspose($matrix): rotates$matrixaround its diagonaladd-matrices($matrix1, $matrix2): add$matrix1and$matrix2
Checking for matrix properties
columns($matrix): return number of columns in$matrixrows($matrix): return number of rows in$matrixis-numeric($matrix): check whether$matrixhas only numeric valuesis-square($matrix): check whether$matrixhas as many rows as columnsis-diagonal($matrix): check whether all values from the main diagonal of$matrixare set while all other values are equal to 0is-lower-triangular($matrix, $flag: null): check whether all value below$matrixdiagonal are equal to 0is-upper-triangular($matrix, $flag: null): check whether all value above$matrixdiagonal are equal to 0
Requirements
All you need is a clean version of Sass 3.3. Otherwise it's just pure Sass madness.
Development
You need
How to
- Fork this repository
- Run
npm install grunt dev- Make your changes + write tests
- Commit + Pull request