Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/travisstaloch/combinatorics.zig
A port of Julia's combinatorics library along with miscellaneous related tools.
https://github.com/travisstaloch/combinatorics.zig
zig-library zig-package zig-programming-language
Last synced: about 1 month ago
JSON representation
A port of Julia's combinatorics library along with miscellaneous related tools.
- Host: GitHub
- URL: https://github.com/travisstaloch/combinatorics.zig
- Owner: travisstaloch
- License: mit
- Created: 2021-05-15T02:19:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-02T00:13:09.000Z (over 2 years ago)
- Last Synced: 2024-10-15T02:44:32.908Z (3 months ago)
- Topics: zig-library, zig-package, zig-programming-language
- Language: Zig
- Homepage:
- Size: 38.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# combinatorics.zig
An incomplete port of Julia's [combinatorics library](https://github.com/JuliaMath/Combinatorics.jl) along with miscellaneous related tools.
__WARNING__ This library is very immature, untested and may have bugs. Use at your own risk.
This library provides itertors over set permutations and combinations. It also provides an [`NChooseK`](src/misc.zig) iterator. `Combination` set sizes are limited to 127. `Permutations` and `nthperm` set sizes are limited to 34. For larger set sizes use `nthpermBig`, `PermutationsBig`, `NChooseKBig` and `CombinationsBig`.
# usage
## get source
### via [gyro](https://github.com/mattnite/gyro) package manager
- in console
- `$ gyro add --src github travisstaloch/combinatorics.zig`
- in build.zig
- `const pkgs = @import("gyro").pkgs;`
- `pkgs.addAllTo(exe/lib/tests);`### otherwise
copy relevent files from src/ into your project or `git submodule` the entire project.
## run tests
To test this project
```console
zig build test
```Or with gyro
```console
gyro build test
```## examples
look at the tests in [permutations.zig](src/permutations.zig), [combinations.zig](src/combinations.zig) and [misc.zig](src/misc.zig). Tests are usually found at the bottom of the files or directly after the thing they're testing.# todo
- export a c api
- support larger sets by using big integers
- [x] nthpermBig and PermutationsBig
- [x] NChooseKBig and CombinationsBig