SassyMatrix 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,20 +1,20 @@
|
|
1
|
-
// Swaps entries `$e1` and `$e2` from `$matrix`
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @require `_valid-coords`
|
4
|
-
// @require `get-entry`
|
5
|
-
// @require `set-entry`
|
6
|
-
// --------------------------------------------------------------------------------
|
7
|
-
// @param $matrix: matrix
|
8
|
-
// @param $e1: (x y) coordinates of first entry
|
9
|
-
// @param $e2: (x y) coordinates of second entry
|
10
|
-
// --------------------------------------------------------------------------------
|
11
|
-
// @return $matrix
|
12
|
-
|
13
|
-
@function swap-entries($matrix, $e1, $e2) {
|
14
|
-
@if _valid-coords($e1, $matrix) and _valid-coords($e2, $matrix) {
|
15
|
-
$tmp: get-entry($matrix, $e1);
|
16
|
-
$matrix: set-entry(set-entry($matrix, $e1, get-entry($matrix, $e2)), $e2, $tmp);
|
17
|
-
@return $matrix;
|
18
|
-
}
|
19
|
-
@return false;
|
20
|
-
}
|
1
|
+
// Swaps entries `$e1` and `$e2` from `$matrix`
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @require `_valid-coords`
|
4
|
+
// @require `get-entry`
|
5
|
+
// @require `set-entry`
|
6
|
+
// --------------------------------------------------------------------------------
|
7
|
+
// @param $matrix: matrix
|
8
|
+
// @param $e1: (x y) coordinates of first entry
|
9
|
+
// @param $e2: (x y) coordinates of second entry
|
10
|
+
// --------------------------------------------------------------------------------
|
11
|
+
// @return $matrix
|
12
|
+
|
13
|
+
@function swap-entries($matrix, $e1, $e2) {
|
14
|
+
@if _valid-coords($e1, $matrix) and _valid-coords($e2, $matrix) {
|
15
|
+
$tmp: get-entry($matrix, $e1);
|
16
|
+
$matrix: set-entry(set-entry($matrix, $e1, get-entry($matrix, $e2)), $e2, $tmp);
|
17
|
+
@return $matrix;
|
18
|
+
}
|
19
|
+
@return false;
|
20
|
+
}
|
@@ -1,24 +1,24 @@
|
|
1
|
-
// Swaps rows `$r1` and `$r2` from `$matrix`
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @require `rows`
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @param $matrix: matrix
|
6
|
-
// @param $r1: index of row 1
|
7
|
-
// @param $r2: index of row 2
|
8
|
-
// --------------------------------------------------------------------------------
|
9
|
-
// @return $matrix
|
10
|
-
|
11
|
-
@function swap-rows($matrix, $r1, $r2) {
|
12
|
-
@if type-of($r1) != number or type-of($r2) != number {
|
13
|
-
@warn "Invalid row index.";
|
14
|
-
@return false;
|
15
|
-
}
|
16
|
-
|
17
|
-
@if abs($r1) > rows($matrix) or abs($r2) > rows($matrix) {
|
18
|
-
@warn "Out of bounds row index.";
|
19
|
-
@return false;
|
20
|
-
}
|
21
|
-
|
22
|
-
$tmp: nth($matrix, $r1);
|
23
|
-
@return set-nth(set-nth($matrix, $r1, nth($matrix, $r2)), $r2, $tmp);
|
24
|
-
}
|
1
|
+
// Swaps rows `$r1` and `$r2` from `$matrix`
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @require `rows`
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @param $matrix: matrix
|
6
|
+
// @param $r1: index of row 1
|
7
|
+
// @param $r2: index of row 2
|
8
|
+
// --------------------------------------------------------------------------------
|
9
|
+
// @return $matrix
|
10
|
+
|
11
|
+
@function swap-rows($matrix, $r1, $r2) {
|
12
|
+
@if type-of($r1) != number or type-of($r2) != number {
|
13
|
+
@warn "Invalid row index.";
|
14
|
+
@return false;
|
15
|
+
}
|
16
|
+
|
17
|
+
@if abs($r1) > rows($matrix) or abs($r2) > rows($matrix) {
|
18
|
+
@warn "Out of bounds row index.";
|
19
|
+
@return false;
|
20
|
+
}
|
21
|
+
|
22
|
+
$tmp: nth($matrix, $r1);
|
23
|
+
@return set-nth(set-nth($matrix, $r1, nth($matrix, $r2)), $r2, $tmp);
|
24
|
+
}
|
data/stylesheets/matrix.scss
CHANGED
@@ -1,103 +1,103 @@
|
|
1
|
-
// Displaying matrix
|
2
|
-
// @dep: none
|
3
|
-
@import "functions/misc/display";
|
4
|
-
|
5
|
-
// Getting number of rows in matrix
|
6
|
-
// @dep: none
|
7
|
-
@import "functions/misc/rows";
|
8
|
-
|
9
|
-
// Getting number of columns in matrix
|
10
|
-
// @dep: none
|
11
|
-
@import "functions/misc/columns";
|
12
|
-
|
13
|
-
// Validate coordinates pairs
|
14
|
-
// @dep: none
|
15
|
-
@import "functions/helpers/valid-coords";
|
16
|
-
|
17
|
-
// Creating a matrix
|
18
|
-
// @dep: `_valid-coords`
|
19
|
-
@import "functions/init/matrix";
|
20
|
-
|
21
|
-
// Assigning values to matrix
|
22
|
-
// @dep: `_valid-coords`
|
23
|
-
@import "functions/setters/set-entry";
|
24
|
-
|
25
|
-
// Reading values from matrix
|
26
|
-
// @dep: `_valid-coords`
|
27
|
-
@import "functions/getters/get-entry";
|
28
|
-
|
29
|
-
// Reading values from matrix
|
30
|
-
// @dep: `rows`
|
31
|
-
@import "functions/getters/get-row";
|
32
|
-
|
33
|
-
// Swapper two rows from matrix
|
34
|
-
// @dep: `rows`
|
35
|
-
@import "functions/swap/swap-rows";
|
36
|
-
|
37
|
-
// Assigning values to matrix
|
38
|
-
// @dep: `rows`, `columns`
|
39
|
-
@import "functions/setters/set-row";
|
40
|
-
|
41
|
-
// Checking if matrix is square
|
42
|
-
// @dep: `rows`, `columns`
|
43
|
-
@import "functions/checkers/is-square";
|
44
|
-
|
45
|
-
// Transpose a matrix
|
46
|
-
// @dep: `columns`, `swap-rows`
|
47
|
-
@import "functions/setters/add-row";
|
48
|
-
|
49
|
-
// Transpose a matrix
|
50
|
-
// @dep: `rows`, `swap-columns`
|
51
|
-
@import "functions/setters/add-column";
|
52
|
-
|
53
|
-
// Assigning values to matrix
|
54
|
-
// @dep: `rows`, `columns`, `set-entry`
|
55
|
-
@import "functions/setters/set-column";
|
56
|
-
|
57
|
-
// Reading values from matrix
|
58
|
-
// @dep: `rows`, `columns`, `get-entry`
|
59
|
-
@import "functions/getters/get-column";
|
60
|
-
|
61
|
-
// Checking if all values from matrix are numbers
|
62
|
-
// @dep: `rows`, `columns`, `get-entry`
|
63
|
-
@import "functions/checkers/is-numeric";
|
64
|
-
|
65
|
-
// Checking if matrix is diagonal
|
66
|
-
// @dep: `rows`, `columns`, `get-entry`
|
67
|
-
@import "functions/checkers/is-diagonal";
|
68
|
-
|
69
|
-
// Is triangular helper
|
70
|
-
// @dep: `rows`, `columns`, `get-entry`
|
71
|
-
@import "functions/helpers/is-triangular";
|
72
|
-
|
73
|
-
// Creating a matrix with diagonal filled
|
74
|
-
// @dep: `matrix`, `_valid-coords`, `set-entry`
|
75
|
-
@import "functions/init/unit-matrix";
|
76
|
-
|
77
|
-
// Swapping two values from matrix
|
78
|
-
// @dep: `_valid-coords`, `get-entry`, `set-entry`
|
79
|
-
@import "functions/swap/swap-entries";
|
80
|
-
|
81
|
-
// Swapper two columns from matrix
|
82
|
-
// @dep: `rows`, `columns`, `get-entry`, `set-entry`
|
83
|
-
@import "functions/swap/swap-columns";
|
84
|
-
|
85
|
-
// Checking if matrix is diagonal
|
86
|
-
// @dep: `rows`, `columns`, `get-entry`, `_is-triangular`
|
87
|
-
@import "functions/checkers/is-upper-triangular";
|
88
|
-
|
89
|
-
// Checking if matrix is diagonal
|
90
|
-
// @dep: `rows`, `columns`, `get-entry`, `_is-triangular`
|
91
|
-
@import "functions/checkers/is-lower-triangular";
|
92
|
-
|
93
|
-
// Add two matrices
|
94
|
-
// @dep: `rows`, `columns`, `get-entry`, `set-entry`
|
95
|
-
@import "functions/misc/add-matrices";
|
96
|
-
|
97
|
-
// Transpose a matrix
|
98
|
-
// @dep: `rows`, `columns`, `get-entry`, `set-entry`
|
99
|
-
@import "functions/misc/transpose";
|
100
|
-
|
101
|
-
// Displaying matrix
|
102
|
-
// @dep: `is-square`, `transpose`
|
1
|
+
// Displaying matrix
|
2
|
+
// @dep: none
|
3
|
+
@import "functions/misc/display";
|
4
|
+
|
5
|
+
// Getting number of rows in matrix
|
6
|
+
// @dep: none
|
7
|
+
@import "functions/misc/rows";
|
8
|
+
|
9
|
+
// Getting number of columns in matrix
|
10
|
+
// @dep: none
|
11
|
+
@import "functions/misc/columns";
|
12
|
+
|
13
|
+
// Validate coordinates pairs
|
14
|
+
// @dep: none
|
15
|
+
@import "functions/helpers/valid-coords";
|
16
|
+
|
17
|
+
// Creating a matrix
|
18
|
+
// @dep: `_valid-coords`
|
19
|
+
@import "functions/init/matrix";
|
20
|
+
|
21
|
+
// Assigning values to matrix
|
22
|
+
// @dep: `_valid-coords`
|
23
|
+
@import "functions/setters/set-entry";
|
24
|
+
|
25
|
+
// Reading values from matrix
|
26
|
+
// @dep: `_valid-coords`
|
27
|
+
@import "functions/getters/get-entry";
|
28
|
+
|
29
|
+
// Reading values from matrix
|
30
|
+
// @dep: `rows`
|
31
|
+
@import "functions/getters/get-row";
|
32
|
+
|
33
|
+
// Swapper two rows from matrix
|
34
|
+
// @dep: `rows`
|
35
|
+
@import "functions/swap/swap-rows";
|
36
|
+
|
37
|
+
// Assigning values to matrix
|
38
|
+
// @dep: `rows`, `columns`
|
39
|
+
@import "functions/setters/set-row";
|
40
|
+
|
41
|
+
// Checking if matrix is square
|
42
|
+
// @dep: `rows`, `columns`
|
43
|
+
@import "functions/checkers/is-square";
|
44
|
+
|
45
|
+
// Transpose a matrix
|
46
|
+
// @dep: `columns`, `swap-rows`
|
47
|
+
@import "functions/setters/add-row";
|
48
|
+
|
49
|
+
// Transpose a matrix
|
50
|
+
// @dep: `rows`, `swap-columns`
|
51
|
+
@import "functions/setters/add-column";
|
52
|
+
|
53
|
+
// Assigning values to matrix
|
54
|
+
// @dep: `rows`, `columns`, `set-entry`
|
55
|
+
@import "functions/setters/set-column";
|
56
|
+
|
57
|
+
// Reading values from matrix
|
58
|
+
// @dep: `rows`, `columns`, `get-entry`
|
59
|
+
@import "functions/getters/get-column";
|
60
|
+
|
61
|
+
// Checking if all values from matrix are numbers
|
62
|
+
// @dep: `rows`, `columns`, `get-entry`
|
63
|
+
@import "functions/checkers/is-numeric";
|
64
|
+
|
65
|
+
// Checking if matrix is diagonal
|
66
|
+
// @dep: `rows`, `columns`, `get-entry`
|
67
|
+
@import "functions/checkers/is-diagonal";
|
68
|
+
|
69
|
+
// Is triangular helper
|
70
|
+
// @dep: `rows`, `columns`, `get-entry`
|
71
|
+
@import "functions/helpers/is-triangular";
|
72
|
+
|
73
|
+
// Creating a matrix with diagonal filled
|
74
|
+
// @dep: `matrix`, `_valid-coords`, `set-entry`
|
75
|
+
@import "functions/init/unit-matrix";
|
76
|
+
|
77
|
+
// Swapping two values from matrix
|
78
|
+
// @dep: `_valid-coords`, `get-entry`, `set-entry`
|
79
|
+
@import "functions/swap/swap-entries";
|
80
|
+
|
81
|
+
// Swapper two columns from matrix
|
82
|
+
// @dep: `rows`, `columns`, `get-entry`, `set-entry`
|
83
|
+
@import "functions/swap/swap-columns";
|
84
|
+
|
85
|
+
// Checking if matrix is diagonal
|
86
|
+
// @dep: `rows`, `columns`, `get-entry`, `_is-triangular`
|
87
|
+
@import "functions/checkers/is-upper-triangular";
|
88
|
+
|
89
|
+
// Checking if matrix is diagonal
|
90
|
+
// @dep: `rows`, `columns`, `get-entry`, `_is-triangular`
|
91
|
+
@import "functions/checkers/is-lower-triangular";
|
92
|
+
|
93
|
+
// Add two matrices
|
94
|
+
// @dep: `rows`, `columns`, `get-entry`, `set-entry`
|
95
|
+
@import "functions/misc/add-matrices";
|
96
|
+
|
97
|
+
// Transpose a matrix
|
98
|
+
// @dep: `rows`, `columns`, `get-entry`, `set-entry`
|
99
|
+
@import "functions/misc/transpose";
|
100
|
+
|
101
|
+
// Displaying matrix
|
102
|
+
// @dep: `is-square`, `transpose`
|
103
103
|
@import "functions/checkers/is-symmetric";
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SassyMatrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Hugo Giraudel
|
@@ -10,7 +9,7 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2014-
|
12
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
14
|
description: Sass API for matrices
|
16
15
|
email:
|
@@ -52,26 +51,25 @@ files:
|
|
52
51
|
- stylesheets/matrix.scss
|
53
52
|
homepage: https://github.com/HugoGiraudel/SassyMatrix/
|
54
53
|
licenses: []
|
54
|
+
metadata: {}
|
55
55
|
post_install_message:
|
56
56
|
rdoc_options: []
|
57
57
|
require_paths:
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
60
|
requirements:
|
62
|
-
- -
|
61
|
+
- - '>='
|
63
62
|
- !ruby/object:Gem::Version
|
64
63
|
version: '0'
|
65
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
65
|
requirements:
|
68
|
-
- -
|
66
|
+
- - '>='
|
69
67
|
- !ruby/object:Gem::Version
|
70
68
|
version: 1.3.6
|
71
69
|
requirements: []
|
72
70
|
rubyforge_project: SassyMatrix
|
73
|
-
rubygems_version:
|
71
|
+
rubygems_version: 2.0.3
|
74
72
|
signing_key:
|
75
|
-
specification_version:
|
73
|
+
specification_version: 4
|
76
74
|
summary: SassyMatrix is a Sass-powered API for matrices.
|
77
75
|
test_files: []
|