Skip to content

travisstaloch/combinatorics.zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

combinatorics.zig

An incomplete port of Julia's combinatorics library 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 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 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

zig build test

Or with gyro

gyro build test

examples

look at the tests in permutations.zig, combinations.zig and 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
    • nthpermBig and PermutationsBig
    • NChooseKBig and CombinationsBig

About

A port of Julia's combinatorics library along with miscellaneous related tools.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages