Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/4t145/tsuki-permutation
https://github.com/4t145/tsuki-permutation
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/4t145/tsuki-permutation
- Owner: 4t145
- Created: 2023-09-04T09:42:25.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-29T07:42:55.000Z (over 1 year ago)
- Last Synced: 2024-04-20T09:01:30.469Z (9 months ago)
- Language: Rust
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
It's a lib for represent and caculate permutation
```rust
let p = perm![1, 2, 0];
let q = perm![2, 1, 0];
// unit element of S3 group
let e3 = perm![@3];
assert_eq!(&e3 + &p, p);
assert_eq!(&p + &e3, p);
assert_eq!(&p * 3, e3);
assert_eq!(&p * 2, &e3 - &p);
dbg!(p);
assert_eq!(p.parity(), Parity::Even);
assert_eq!((&p + &p).parity(), Parity::Even);
assert_eq!((&q + &q).parity(), Parity::Even);
assert_eq!((&q + &p).parity(), Parity::Odd);
assert_eq!((&p + &q).parity(), Parity::Odd);
```