-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpermutation_test.go
More file actions
37 lines (31 loc) · 824 Bytes
/
permutation_test.go
File metadata and controls
37 lines (31 loc) · 824 Bytes
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
package ap_test
import (
"fmt"
"github.com/ryanjoneil/ap"
)
func ExamplePermutation_Cycles() {
p := ap.Permutation{1, 0, 2, 6, 5, 3, 4}
fmt.Println(p.Cycles())
// Output:
// [[0 1] [2] [3 6 4 5]]
}
func ExamplePermutation_Inverse() {
p := ap.Permutation{1, 0, 2, 6, 5, 3, 4}
fmt.Println(p.Inverse())
// Output:
// [1 0 2 5 6 4 3]
}
func ExamplePermutation_Matrix() {
p := ap.Permutation{1, 0, 2, 6, 5, 3, 4}
for _, row := range p.Matrix() {
fmt.Println(row)
}
// Output:
// [false true false false false false false]
// [true false false false false false false]
// [false false true false false false false]
// [false false false false false false true]
// [false false false false false true false]
// [false false false true false false false]
// [false false false false true false false]
}