-
Notifications
You must be signed in to change notification settings - Fork 1
/
matrix_test.go
52 lines (47 loc) · 1.22 KB
/
matrix_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package ap_test
import (
"fmt"
"github.com/ryanjoneil/ap"
)
func ExampleMatrix_Cycles() {
m := ap.Matrix{
[]bool{true, false, false, false, false},
[]bool{false, false, false, false, true},
[]bool{false, false, false, true, false},
[]bool{false, true, false, false, false},
[]bool{false, false, true, false, false},
}
fmt.Println(m.Cycles())
// Output:
// [[0] [1 4 2 3]]
}
func ExampleMatrix_Inverse() {
m := ap.Matrix{
[]bool{true, false, false, false, false},
[]bool{false, false, false, false, true},
[]bool{false, false, false, true, false},
[]bool{false, true, false, false, false},
[]bool{false, false, true, false, false},
}
for _, row := range m.Inverse() {
fmt.Println(row)
}
// Output:
// [true false false false false]
// [false false false true false]
// [false false false false true]
// [false false true false false]
// [false true false false false]
}
func ExampleMatrix_Permutation() {
m := ap.Matrix{
[]bool{true, false, false, false, false},
[]bool{false, false, false, false, true},
[]bool{false, false, false, true, false},
[]bool{false, true, false, false, false},
[]bool{false, false, true, false, false},
}
fmt.Println(m.Permutation())
// Output:
// [0 4 3 1 2]
}