SassyMatrix 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/CHANGELOG.md +16 -16
 - data/README.md +61 -61
 - data/lib/SassyMatrix.rb +14 -14
 - data/stylesheets/functions/checkers/_is-diagonal.scss +22 -22
 - data/stylesheets/functions/checkers/_is-lower-triangular.scss +12 -12
 - data/stylesheets/functions/checkers/_is-numeric.scss +18 -18
 - data/stylesheets/functions/checkers/_is-square.scss +11 -11
 - data/stylesheets/functions/checkers/_is-symmetric.scss +14 -14
 - data/stylesheets/functions/checkers/_is-upper-triangular.scss +12 -12
 - data/stylesheets/functions/getters/_get-column.scss +29 -29
 - data/stylesheets/functions/getters/_get-entry.scss +20 -20
 - data/stylesheets/functions/getters/_get-row.scss +21 -21
 - data/stylesheets/functions/helpers/_is-triangular.scss +30 -30
 - data/stylesheets/functions/helpers/_valid-coords.scss +37 -37
 - data/stylesheets/functions/init/_matrix.scss +23 -23
 - data/stylesheets/functions/init/_unit-matrix.scss +25 -25
 - data/stylesheets/functions/misc/_add-matrices.scss +33 -33
 - data/stylesheets/functions/misc/_columns.scss +9 -9
 - data/stylesheets/functions/misc/_display.scss +42 -42
 - data/stylesheets/functions/misc/_rows.scss +8 -8
 - data/stylesheets/functions/misc/_transpose.scss +22 -22
 - data/stylesheets/functions/setters/_add-column.scss +34 -34
 - data/stylesheets/functions/setters/_add-row.scss +32 -32
 - data/stylesheets/functions/setters/_set-column.scss +42 -42
 - data/stylesheets/functions/setters/_set-entry.scss +19 -19
 - data/stylesheets/functions/setters/_set-row.scss +36 -36
 - data/stylesheets/functions/swap/_swap-columns.scss +32 -32
 - data/stylesheets/functions/swap/_swap-entries.scss +20 -20
 - data/stylesheets/functions/swap/_swap-rows.scss +24 -24
 - data/stylesheets/matrix.scss +102 -102
 - metadata +7 -9
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a9085263b129702c110334c0803c6d3ca266d50e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3793b8b220cc1c663e1bedf0b63b150a7f0cce67
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 773877dcb709ef386a570f7f322898ef6acc4b0ae2176511877a76d975b5fe12cdba283106034e55fc3f09a5b9ec9775cd130e510e33de3062cb93065c313e45
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c0f3f413a2284ac330fdc93fe61bfa17c99a36729968a043df644933224155dea70e9e20180eb1a7b18005c4a251fec9c1361b143f100709821ac4ffcc848052
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,16 +1,16 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Changelog
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            * `1.0.11`: fixing an issue with scientific number parsing
         
     | 
| 
       4 
     | 
    
         
            -
            * `1.0.10`: improving number and string helpers
         
     | 
| 
       5 
     | 
    
         
            -
            * `1.0.9`: fixing a bug in `_find-exponent`
         
     | 
| 
       6 
     | 
    
         
            -
            * `1.0.8`: fixing a major issue in Ruby Gem
         
     | 
| 
       7 
     | 
    
         
            -
            * `1.0.7`: minor fixes and stable Ruby Gem
         
     | 
| 
       8 
     | 
    
         
            -
            * `1.0.6`: released a Ruby Gem
         
     | 
| 
       9 
     | 
    
         
            -
            * `1.0.5`: improved the encoding mixin
         
     | 
| 
       10 
     | 
    
         
            -
            * `1.0.4`: fixed an error in map parsing
         
     | 
| 
       11 
     | 
    
         
            -
            * `1.0.3`: slightly edited the mixin to dump JSON to CSS
         
     | 
| 
       12 
     | 
    
         
            -
            * `1.0.2`: fixed an issue with string parsing
         
     | 
| 
       13 
     | 
    
         
            -
            * `1.0.1`: fixed an issue with alpha color parsing
         
     | 
| 
       14 
     | 
    
         
            -
            * `1.0.0`: Stable API. `json-encode` and `json-decode`
         
     | 
| 
       15 
     | 
    
         
            -
            * `0.0.2`: added `json-decode` and test
         
     | 
| 
       16 
     | 
    
         
            -
            * `0.0.1`: initial commit
         
     | 
| 
      
 1 
     | 
    
         
            +
            # Changelog
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * `1.0.11`: fixing an issue with scientific number parsing
         
     | 
| 
      
 4 
     | 
    
         
            +
            * `1.0.10`: improving number and string helpers
         
     | 
| 
      
 5 
     | 
    
         
            +
            * `1.0.9`: fixing a bug in `_find-exponent`
         
     | 
| 
      
 6 
     | 
    
         
            +
            * `1.0.8`: fixing a major issue in Ruby Gem
         
     | 
| 
      
 7 
     | 
    
         
            +
            * `1.0.7`: minor fixes and stable Ruby Gem
         
     | 
| 
      
 8 
     | 
    
         
            +
            * `1.0.6`: released a Ruby Gem
         
     | 
| 
      
 9 
     | 
    
         
            +
            * `1.0.5`: improved the encoding mixin
         
     | 
| 
      
 10 
     | 
    
         
            +
            * `1.0.4`: fixed an error in map parsing
         
     | 
| 
      
 11 
     | 
    
         
            +
            * `1.0.3`: slightly edited the mixin to dump JSON to CSS
         
     | 
| 
      
 12 
     | 
    
         
            +
            * `1.0.2`: fixed an issue with string parsing
         
     | 
| 
      
 13 
     | 
    
         
            +
            * `1.0.1`: fixed an issue with alpha color parsing
         
     | 
| 
      
 14 
     | 
    
         
            +
            * `1.0.0`: Stable API. `json-encode` and `json-decode`
         
     | 
| 
      
 15 
     | 
    
         
            +
            * `0.0.2`: added `json-decode` and test
         
     | 
| 
      
 16 
     | 
    
         
            +
            * `0.0.1`: initial commit
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,61 +1,61 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # SassyMatrix [](https://travis-ci.org/HugoGiraudel/SassyMatrix)
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            All you ever wanted to deal with matrices in Sass.
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            ## What's in there?
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            ### Instanciating matrix
         
     | 
| 
       8 
     | 
    
         
            -
            * `matrix($x, $y: $x)`: create a matrix of `$x` rows by `$y` columns filled with 0s
         
     | 
| 
       9 
     | 
    
         
            -
            * `unit-matrix($x, $y)`: create a matrix of `$x` rows by `$y` columns filled with 0s except the diagonal which is filled with 1s
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            ### Writing in matrix
         
     | 
| 
       12 
     | 
    
         
            -
            * `set-entry($matrix, $coords, $value)`: set `$value` at `$matrix[$coords[1], $coords[2]]`
         
     | 
| 
       13 
     | 
    
         
            -
            * `set-column($matrix, $index, $column: ())`: set `$column` at `$index` in `$matrix`
         
     | 
| 
       14 
     | 
    
         
            -
            * `set-row($matrix, $index, $row: ())`: set `$row` at `$index` in `$matrix`
         
     | 
| 
       15 
     | 
    
         
            -
            * `add-column($matrix, $column: (), $index: null)`: add `$column` at `$index` in `$matrix`
         
     | 
| 
       16 
     | 
    
         
            -
            * `add-row($matrix, $row: (), $index: null)`: add `$row` at `$index` in `$matrix`
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            ### Reading matrix
         
     | 
| 
       19 
     | 
    
         
            -
            * `get-entry($matrix, $coords)`: get entry at `$matrix[$coords[1], $coords[2]]`
         
     | 
| 
       20 
     | 
    
         
            -
            * `get-column($matrix, $index)`: get column at `$index` from `$matrix`
         
     | 
| 
       21 
     | 
    
         
            -
            * `get-row($matrix, $index)`: get row at `$index` from `$matrix`
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            ### Displaying matrix
         
     | 
| 
       24 
     | 
    
         
            -
            * `display($matrix)`: display matrix
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            ### Altering matrix
         
     | 
| 
       27 
     | 
    
         
            -
            * `swap-entries($matrix, $e1, $e2)`: swaps values `$e1` and `$e2` from `$matrix`
         
     | 
| 
       28 
     | 
    
         
            -
            * `swap-rows($matrix, $r1, $r2)`: swaps rows `$r1` and `$r2` from `$matrix`
         
     | 
| 
       29 
     | 
    
         
            -
            * `swap-columns($matrix, $c1, $c2)`: swaps columns `$c1` and `$c2` from `$matrix`
         
     | 
| 
       30 
     | 
    
         
            -
            * `transpose($matrix)`: rotates `$matrix` around its diagonal
         
     | 
| 
       31 
     | 
    
         
            -
            * `add-matrices($matrix1, $matrix2)`: add `$matrix1` and `$matrix2`
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
            ### Checking for matrix properties
         
     | 
| 
       34 
     | 
    
         
            -
            * `columns($matrix)`: return number of columns in `$matrix`
         
     | 
| 
       35 
     | 
    
         
            -
            * `rows($matrix)`: return number of rows in `$matrix`
         
     | 
| 
       36 
     | 
    
         
            -
            * `is-numeric($matrix)`: check whether `$matrix` has only numeric values
         
     | 
| 
       37 
     | 
    
         
            -
            * `is-square($matrix)`: check whether `$matrix` has as many rows as columns
         
     | 
| 
       38 
     | 
    
         
            -
            * `is-diagonal($matrix)`: check whether all values from the main diagonal of `$matrix` are set while all other values are equal to 0
         
     | 
| 
       39 
     | 
    
         
            -
            * `is-lower-triangular($matrix, $flag: null)`: check whether all value below `$matrix` diagonal are equal to 0
         
     | 
| 
       40 
     | 
    
         
            -
            * `is-upper-triangular($matrix, $flag: null)`: check whether all value above `$matrix` diagonal are equal to 0
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            ## Requirements
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
            All you need is a clean version of Sass 3.3. Otherwise it's just pure Sass madness.
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
            ## Development
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
            ### You need
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
              * [NodeJS](http://nodejs.org)
         
     | 
| 
       51 
     | 
    
         
            -
              * [Ruby](https://www.ruby-lang.org/)
         
     | 
| 
       52 
     | 
    
         
            -
              * Sass 3.3 via `gem instal sass --pre`
         
     | 
| 
       53 
     | 
    
         
            -
              * `grunt-cli` via `npm install -g grunt-cli`
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            ### How to
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
              1. Fork this repository
         
     | 
| 
       58 
     | 
    
         
            -
              2. Run `npm install`
         
     | 
| 
       59 
     | 
    
         
            -
              3. `grunt dev`
         
     | 
| 
       60 
     | 
    
         
            -
              4. Make your changes + write tests
         
     | 
| 
       61 
     | 
    
         
            -
              5. Commit + Pull request
         
     | 
| 
      
 1 
     | 
    
         
            +
            # SassyMatrix [](https://travis-ci.org/HugoGiraudel/SassyMatrix)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            All you ever wanted to deal with matrices in Sass.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## What's in there?
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ### Instanciating matrix
         
     | 
| 
      
 8 
     | 
    
         
            +
            * `matrix($x, $y: $x)`: create a matrix of `$x` rows by `$y` columns filled with 0s
         
     | 
| 
      
 9 
     | 
    
         
            +
            * `unit-matrix($x, $y)`: create a matrix of `$x` rows by `$y` columns filled with 0s except the diagonal which is filled with 1s
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### Writing in matrix
         
     | 
| 
      
 12 
     | 
    
         
            +
            * `set-entry($matrix, $coords, $value)`: set `$value` at `$matrix[$coords[1], $coords[2]]`
         
     | 
| 
      
 13 
     | 
    
         
            +
            * `set-column($matrix, $index, $column: ())`: set `$column` at `$index` in `$matrix`
         
     | 
| 
      
 14 
     | 
    
         
            +
            * `set-row($matrix, $index, $row: ())`: set `$row` at `$index` in `$matrix`
         
     | 
| 
      
 15 
     | 
    
         
            +
            * `add-column($matrix, $column: (), $index: null)`: add `$column` at `$index` in `$matrix`
         
     | 
| 
      
 16 
     | 
    
         
            +
            * `add-row($matrix, $row: (), $index: null)`: add `$row` at `$index` in `$matrix`
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ### Reading matrix
         
     | 
| 
      
 19 
     | 
    
         
            +
            * `get-entry($matrix, $coords)`: get entry at `$matrix[$coords[1], $coords[2]]`
         
     | 
| 
      
 20 
     | 
    
         
            +
            * `get-column($matrix, $index)`: get column at `$index` from `$matrix`
         
     | 
| 
      
 21 
     | 
    
         
            +
            * `get-row($matrix, $index)`: get row at `$index` from `$matrix`
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ### Displaying matrix
         
     | 
| 
      
 24 
     | 
    
         
            +
            * `display($matrix)`: display matrix
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ### Altering matrix
         
     | 
| 
      
 27 
     | 
    
         
            +
            * `swap-entries($matrix, $e1, $e2)`: swaps values `$e1` and `$e2` from `$matrix`
         
     | 
| 
      
 28 
     | 
    
         
            +
            * `swap-rows($matrix, $r1, $r2)`: swaps rows `$r1` and `$r2` from `$matrix`
         
     | 
| 
      
 29 
     | 
    
         
            +
            * `swap-columns($matrix, $c1, $c2)`: swaps columns `$c1` and `$c2` from `$matrix`
         
     | 
| 
      
 30 
     | 
    
         
            +
            * `transpose($matrix)`: rotates `$matrix` around its diagonal
         
     | 
| 
      
 31 
     | 
    
         
            +
            * `add-matrices($matrix1, $matrix2)`: add `$matrix1` and `$matrix2`
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            ### Checking for matrix properties
         
     | 
| 
      
 34 
     | 
    
         
            +
            * `columns($matrix)`: return number of columns in `$matrix`
         
     | 
| 
      
 35 
     | 
    
         
            +
            * `rows($matrix)`: return number of rows in `$matrix`
         
     | 
| 
      
 36 
     | 
    
         
            +
            * `is-numeric($matrix)`: check whether `$matrix` has only numeric values
         
     | 
| 
      
 37 
     | 
    
         
            +
            * `is-square($matrix)`: check whether `$matrix` has as many rows as columns
         
     | 
| 
      
 38 
     | 
    
         
            +
            * `is-diagonal($matrix)`: check whether all values from the main diagonal of `$matrix` are set while all other values are equal to 0
         
     | 
| 
      
 39 
     | 
    
         
            +
            * `is-lower-triangular($matrix, $flag: null)`: check whether all value below `$matrix` diagonal are equal to 0
         
     | 
| 
      
 40 
     | 
    
         
            +
            * `is-upper-triangular($matrix, $flag: null)`: check whether all value above `$matrix` diagonal are equal to 0
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            ## Requirements
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            All you need is a clean version of Sass 3.3. Otherwise it's just pure Sass madness.
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            ### You need
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              * [NodeJS](http://nodejs.org)
         
     | 
| 
      
 51 
     | 
    
         
            +
              * [Ruby](https://www.ruby-lang.org/)
         
     | 
| 
      
 52 
     | 
    
         
            +
              * Sass 3.3 via `gem instal sass --pre`
         
     | 
| 
      
 53 
     | 
    
         
            +
              * `grunt-cli` via `npm install -g grunt-cli`
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            ### How to
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              1. Fork this repository
         
     | 
| 
      
 58 
     | 
    
         
            +
              2. Run `npm install`
         
     | 
| 
      
 59 
     | 
    
         
            +
              3. `grunt dev`
         
     | 
| 
      
 60 
     | 
    
         
            +
              4. Make your changes + write tests
         
     | 
| 
      
 61 
     | 
    
         
            +
              5. Commit + Pull request
         
     | 
    
        data/lib/SassyMatrix.rb
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'compass'
         
     | 
| 
       2 
     | 
    
         
            -
            extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
         
     | 
| 
       3 
     | 
    
         
            -
            Compass::Frameworks.register(' 
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            #  Version is a number. If a version contains alphas, it will be created as a prerelease version
         
     | 
| 
       6 
     | 
    
         
            -
            #  Date is in the form of YYYY-MM-DD
         
     | 
| 
       7 
     | 
    
         
            -
            module SassyMatrix
         
     | 
| 
       8 
     | 
    
         
            -
              VERSION = "1.0. 
     | 
| 
       9 
     | 
    
         
            -
              DATE = "2014- 
     | 
| 
       10 
     | 
    
         
            -
            end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            module Sass::Script::Functions
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require 'compass'
         
     | 
| 
      
 2 
     | 
    
         
            +
            extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
         
     | 
| 
      
 3 
     | 
    
         
            +
            Compass::Frameworks.register('SassyMatrix', :path => extension_path)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            #  Version is a number. If a version contains alphas, it will be created as a prerelease version
         
     | 
| 
      
 6 
     | 
    
         
            +
            #  Date is in the form of YYYY-MM-DD
         
     | 
| 
      
 7 
     | 
    
         
            +
            module SassyMatrix
         
     | 
| 
      
 8 
     | 
    
         
            +
              VERSION = "1.0.1"
         
     | 
| 
      
 9 
     | 
    
         
            +
              DATE = "2014-03-21"
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            module Sass::Script::Functions
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,22 +1,22 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Checks whether all entries from the main diagonal of `$matrix`
         
     | 
| 
       2 
     | 
    
         
            -
            // are set while all other entries are equal to the 0
         
     | 
| 
       3 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       4 
     | 
    
         
            -
            // @require `get-entry`
         
     | 
| 
       5 
     | 
    
         
            -
            // @require `columns`
         
     | 
| 
       6 
     | 
    
         
            -
            // @require `rows`
         
     | 
| 
       7 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       8 
     | 
    
         
            -
            // @param $matrix: matrix
         
     | 
| 
       9 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       10 
     | 
    
         
            -
            // @return boolean
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            @function is-diagonal($matrix) {
         
     | 
| 
       13 
     | 
    
         
            -
              @for $i from 1 through rows($matrix) {
         
     | 
| 
       14 
     | 
    
         
            -
                @for $j from 1 through columns($matrix) {
         
     | 
| 
       15 
     | 
    
         
            -
                  $entry: get-entry($matrix, ($i $j));
         
     | 
| 
       16 
     | 
    
         
            -
                  @if ($i != $j and $entry != 0) or ($i == $j and $entry == 0) {
         
     | 
| 
       17 
     | 
    
         
            -
                    @return false;
         
     | 
| 
       18 
     | 
    
         
            -
                  }
         
     | 
| 
       19 
     | 
    
         
            -
                }
         
     | 
| 
       20 
     | 
    
         
            -
              }
         
     | 
| 
       21 
     | 
    
         
            -
              @return true;
         
     | 
| 
       22 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Checks whether all entries from the main diagonal of `$matrix`
         
     | 
| 
      
 2 
     | 
    
         
            +
            // are set while all other entries are equal to the 0
         
     | 
| 
      
 3 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 4 
     | 
    
         
            +
            // @require `get-entry`
         
     | 
| 
      
 5 
     | 
    
         
            +
            // @require `columns`
         
     | 
| 
      
 6 
     | 
    
         
            +
            // @require `rows`
         
     | 
| 
      
 7 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 8 
     | 
    
         
            +
            // @param $matrix: matrix
         
     | 
| 
      
 9 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 10 
     | 
    
         
            +
            // @return boolean
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            @function is-diagonal($matrix) {
         
     | 
| 
      
 13 
     | 
    
         
            +
              @for $i from 1 through rows($matrix) {
         
     | 
| 
      
 14 
     | 
    
         
            +
                @for $j from 1 through columns($matrix) {
         
     | 
| 
      
 15 
     | 
    
         
            +
                  $entry: get-entry($matrix, ($i $j));
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @if ($i != $j and $entry != 0) or ($i == $j and $entry == 0) {
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @return false;
         
     | 
| 
      
 18 
     | 
    
         
            +
                  }
         
     | 
| 
      
 19 
     | 
    
         
            +
                }
         
     | 
| 
      
 20 
     | 
    
         
            +
              }
         
     | 
| 
      
 21 
     | 
    
         
            +
              @return true;
         
     | 
| 
      
 22 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,12 +1,12 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Checks whether `$matrix` is lower triangular with `$flag` option
         
     | 
| 
       2 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       3 
     | 
    
         
            -
            // @require `_is-triangular`
         
     | 
| 
       4 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       5 
     | 
    
         
            -
            // @param $matrix: matrix
         
     | 
| 
       6 
     | 
    
         
            -
            // @param $flag: advanced option (null | strict | unit | atom)
         
     | 
| 
       7 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       8 
     | 
    
         
            -
            // @return boolean
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            @function is-lower-triangular($matrix, $flag: null) {
         
     | 
| 
       11 
     | 
    
         
            -
              @return _is-triangular($matrix, bottom, $flag);
         
     | 
| 
       12 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Checks whether `$matrix` is lower triangular with `$flag` option
         
     | 
| 
      
 2 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 3 
     | 
    
         
            +
            // @require `_is-triangular`
         
     | 
| 
      
 4 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 5 
     | 
    
         
            +
            // @param $matrix: matrix
         
     | 
| 
      
 6 
     | 
    
         
            +
            // @param $flag: advanced option (null | strict | unit | atom)
         
     | 
| 
      
 7 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 8 
     | 
    
         
            +
            // @return boolean
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            @function is-lower-triangular($matrix, $flag: null) {
         
     | 
| 
      
 11 
     | 
    
         
            +
              @return _is-triangular($matrix, bottom, $flag);
         
     | 
| 
      
 12 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,18 +1,18 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Checks whether all entries from `$matrix` are numeric
         
     | 
| 
       2 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       3 
     | 
    
         
            -
            // @require `rows`
         
     | 
| 
       4 
     | 
    
         
            -
            // @require `columns`
         
     | 
| 
       5 
     | 
    
         
            -
            // @require `get-entry`
         
     | 
| 
       6 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       7 
     | 
    
         
            -
            // @return boolean
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            @function is-numeric($matrix) {
         
     | 
| 
       10 
     | 
    
         
            -
              @for $i from 1 through rows($matrix) {
         
     | 
| 
       11 
     | 
    
         
            -
                @for $j from 1 through columns($matrix) {
         
     | 
| 
       12 
     | 
    
         
            -
                  @if type-of(get-entry($matrix, ($i $j))) != number {
         
     | 
| 
       13 
     | 
    
         
            -
                    @return false;
         
     | 
| 
       14 
     | 
    
         
            -
                  }
         
     | 
| 
       15 
     | 
    
         
            -
                }
         
     | 
| 
       16 
     | 
    
         
            -
              }
         
     | 
| 
       17 
     | 
    
         
            -
              @return true;
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Checks whether all entries from `$matrix` are numeric
         
     | 
| 
      
 2 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 3 
     | 
    
         
            +
            // @require `rows`
         
     | 
| 
      
 4 
     | 
    
         
            +
            // @require `columns`
         
     | 
| 
      
 5 
     | 
    
         
            +
            // @require `get-entry`
         
     | 
| 
      
 6 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 7 
     | 
    
         
            +
            // @return boolean
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            @function is-numeric($matrix) {
         
     | 
| 
      
 10 
     | 
    
         
            +
              @for $i from 1 through rows($matrix) {
         
     | 
| 
      
 11 
     | 
    
         
            +
                @for $j from 1 through columns($matrix) {
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @if type-of(get-entry($matrix, ($i $j))) != number {
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @return false;
         
     | 
| 
      
 14 
     | 
    
         
            +
                  }
         
     | 
| 
      
 15 
     | 
    
         
            +
                }
         
     | 
| 
      
 16 
     | 
    
         
            +
              }
         
     | 
| 
      
 17 
     | 
    
         
            +
              @return true;
         
     | 
| 
      
 18 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,12 +1,12 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Returns whether `$matrix` has as many rows as columns
         
     | 
| 
       2 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       3 
     | 
    
         
            -
            // @require `columns`
         
     | 
| 
       4 
     | 
    
         
            -
            // @require `rows`
         
     | 
| 
       5 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       6 
     | 
    
         
            -
            // @param $matrix: matrix
         
     | 
| 
       7 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       8 
     | 
    
         
            -
            // @return boolean
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            @function is-square($matrix) {
         
     | 
| 
       11 
     | 
    
         
            -
              @return columns($matrix) == rows($matrix);
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Returns whether `$matrix` has as many rows as columns
         
     | 
| 
      
 2 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 3 
     | 
    
         
            +
            // @require `columns`
         
     | 
| 
      
 4 
     | 
    
         
            +
            // @require `rows`
         
     | 
| 
      
 5 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 6 
     | 
    
         
            +
            // @param $matrix: matrix
         
     | 
| 
      
 7 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 8 
     | 
    
         
            +
            // @return boolean
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            @function is-square($matrix) {
         
     | 
| 
      
 11 
     | 
    
         
            +
              @return columns($matrix) == rows($matrix);
         
     | 
| 
       12 
12 
     | 
    
         
             
            }
         
     | 
| 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Checks whether a matrix is symetric
         
     | 
| 
       2 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       3 
     | 
    
         
            -
            // @require `transpose`
         
     | 
| 
       4 
     | 
    
         
            -
            // @require `is-square`
         
     | 
| 
       5 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       6 
     | 
    
         
            -
            // @param $matrix: matrix
         
     | 
| 
       7 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       8 
     | 
    
         
            -
            // @return boolean
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            @function is-symmetric($matrix) {
         
     | 
| 
       11 
     | 
    
         
            -
              @if not is-square($matrix) {
         
     | 
| 
       12 
     | 
    
         
            -
                @return false;
         
     | 
| 
       13 
     | 
    
         
            -
              }
         
     | 
| 
       14 
     | 
    
         
            -
              @return $matrix == transpose($matrix);
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Checks whether a matrix is symetric
         
     | 
| 
      
 2 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 3 
     | 
    
         
            +
            // @require `transpose`
         
     | 
| 
      
 4 
     | 
    
         
            +
            // @require `is-square`
         
     | 
| 
      
 5 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 6 
     | 
    
         
            +
            // @param $matrix: matrix
         
     | 
| 
      
 7 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 8 
     | 
    
         
            +
            // @return boolean
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            @function is-symmetric($matrix) {
         
     | 
| 
      
 11 
     | 
    
         
            +
              @if not is-square($matrix) {
         
     | 
| 
      
 12 
     | 
    
         
            +
                @return false;
         
     | 
| 
      
 13 
     | 
    
         
            +
              }
         
     | 
| 
      
 14 
     | 
    
         
            +
              @return $matrix == transpose($matrix);
         
     | 
| 
       15 
15 
     | 
    
         
             
            }
         
     | 
| 
         @@ -1,12 +1,12 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Checks whether `$matrix` is upper triangular with `$flag` option
         
     | 
| 
       2 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       3 
     | 
    
         
            -
            // @require `_is-triangular`
         
     | 
| 
       4 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       5 
     | 
    
         
            -
            // @param $matrix: matrix
         
     | 
| 
       6 
     | 
    
         
            -
            // @param $flag: advanced option (null | strict | unit | atom)
         
     | 
| 
       7 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       8 
     | 
    
         
            -
            // @return boolean
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            @function is-upper-triangular($matrix, $flag: null) {
         
     | 
| 
       11 
     | 
    
         
            -
              @return _is-triangular($matrix, top, $flag);
         
     | 
| 
       12 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Checks whether `$matrix` is upper triangular with `$flag` option
         
     | 
| 
      
 2 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 3 
     | 
    
         
            +
            // @require `_is-triangular`
         
     | 
| 
      
 4 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 5 
     | 
    
         
            +
            // @param $matrix: matrix
         
     | 
| 
      
 6 
     | 
    
         
            +
            // @param $flag: advanced option (null | strict | unit | atom)
         
     | 
| 
      
 7 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 8 
     | 
    
         
            +
            // @return boolean
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            @function is-upper-triangular($matrix, $flag: null) {
         
     | 
| 
      
 11 
     | 
    
         
            +
              @return _is-triangular($matrix, top, $flag);
         
     | 
| 
      
 12 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,29 +1,29 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Return column at `$index` from `$matrix`
         
     | 
| 
       2 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       3 
     | 
    
         
            -
            // @require `get-entry`
         
     | 
| 
       4 
     | 
    
         
            -
            // @require `rows`
         
     | 
| 
       5 
     | 
    
         
            -
            // @require `columns`
         
     | 
| 
       6 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       7 
     | 
    
         
            -
            // @param $matrix: matrix
         
     | 
| 
       8 
     | 
    
         
            -
            // @param $index: index
         
     | 
| 
       9 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       10 
     | 
    
         
            -
            // @return list
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            @function get-column($matrix, $index) {
         
     | 
| 
       13 
     | 
    
         
            -
              @if type-of($index) != number {
         
     | 
| 
       14 
     | 
    
         
            -
                @warn "Invalid column index.";
         
     | 
| 
       15 
     | 
    
         
            -
                @return false;
         
     | 
| 
       16 
     | 
    
         
            -
              }
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
              @if abs($index) > columns($matrix) {
         
     | 
| 
       19 
     | 
    
         
            -
                @warn "Out of bound column index.";
         
     | 
| 
       20 
     | 
    
         
            -
                @return false;
         
     | 
| 
       21 
     | 
    
         
            -
              }
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              $column: ();
         
     | 
| 
       24 
     | 
    
         
            -
              @for $i from 1 through rows($matrix) {
         
     | 
| 
       25 
     | 
    
         
            -
                $column: append($column, get-entry($matrix, ($i $index)))
         
     | 
| 
       26 
     | 
    
         
            -
              }
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              @return $column;
         
     | 
| 
       29 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Return column at `$index` from `$matrix`
         
     | 
| 
      
 2 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 3 
     | 
    
         
            +
            // @require `get-entry`
         
     | 
| 
      
 4 
     | 
    
         
            +
            // @require `rows`
         
     | 
| 
      
 5 
     | 
    
         
            +
            // @require `columns`
         
     | 
| 
      
 6 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 7 
     | 
    
         
            +
            // @param $matrix: matrix
         
     | 
| 
      
 8 
     | 
    
         
            +
            // @param $index: index
         
     | 
| 
      
 9 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 10 
     | 
    
         
            +
            // @return list
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            @function get-column($matrix, $index) {
         
     | 
| 
      
 13 
     | 
    
         
            +
              @if type-of($index) != number {
         
     | 
| 
      
 14 
     | 
    
         
            +
                @warn "Invalid column index.";
         
     | 
| 
      
 15 
     | 
    
         
            +
                @return false;
         
     | 
| 
      
 16 
     | 
    
         
            +
              }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              @if abs($index) > columns($matrix) {
         
     | 
| 
      
 19 
     | 
    
         
            +
                @warn "Out of bound column index.";
         
     | 
| 
      
 20 
     | 
    
         
            +
                @return false;
         
     | 
| 
      
 21 
     | 
    
         
            +
              }
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              $column: ();
         
     | 
| 
      
 24 
     | 
    
         
            +
              @for $i from 1 through rows($matrix) {
         
     | 
| 
      
 25 
     | 
    
         
            +
                $column: append($column, get-entry($matrix, ($i $index)))
         
     | 
| 
      
 26 
     | 
    
         
            +
              }
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              @return $column;
         
     | 
| 
      
 29 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,20 +1,20 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Returns entry at `$matrix[$coords[1], $coords[2]]`
         
     | 
| 
       2 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       3 
     | 
    
         
            -
            // @require `_valid-coords`
         
     | 
| 
       4 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       5 
     | 
    
         
            -
            // @param $matrix: matrix
         
     | 
| 
       6 
     | 
    
         
            -
            // @param $coords: (x y) coordinates
         
     | 
| 
       7 
     | 
    
         
            -
            // --------------------------------------------------------------------------------
         
     | 
| 
       8 
     | 
    
         
            -
            // @return literal
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            @function get-entry($matrix, $coords) {
         
     | 
| 
       11 
     | 
    
         
            -
              @if length($coords) == 1 {
         
     | 
| 
       12 
     | 
    
         
            -
                $coords: ($coords $coords);
         
     | 
| 
       13 
     | 
    
         
            -
              }
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              @if _valid-coords($coords, $matrix) {
         
     | 
| 
       16 
     | 
    
         
            -
                @return nth(nth($matrix, nth($coords, 1)), nth($coords, 2));
         
     | 
| 
       17 
     | 
    
         
            -
              }
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              @return false;
         
     | 
| 
       20 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            // Returns entry at `$matrix[$coords[1], $coords[2]]`
         
     | 
| 
      
 2 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 3 
     | 
    
         
            +
            // @require `_valid-coords`
         
     | 
| 
      
 4 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 5 
     | 
    
         
            +
            // @param $matrix: matrix
         
     | 
| 
      
 6 
     | 
    
         
            +
            // @param $coords: (x y) coordinates
         
     | 
| 
      
 7 
     | 
    
         
            +
            // --------------------------------------------------------------------------------
         
     | 
| 
      
 8 
     | 
    
         
            +
            // @return literal
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            @function get-entry($matrix, $coords) {
         
     | 
| 
      
 11 
     | 
    
         
            +
              @if length($coords) == 1 {
         
     | 
| 
      
 12 
     | 
    
         
            +
                $coords: ($coords $coords);
         
     | 
| 
      
 13 
     | 
    
         
            +
              }
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              @if _valid-coords($coords, $matrix) {
         
     | 
| 
      
 16 
     | 
    
         
            +
                @return nth(nth($matrix, nth($coords, 1)), nth($coords, 2));
         
     | 
| 
      
 17 
     | 
    
         
            +
              }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              @return false;
         
     | 
| 
      
 20 
     | 
    
         
            +
            }
         
     |