Version History |
Implements generic IEquatable interface.
Implements proper null tests for comparison operators.
Updates build environment to Visual Studio 2010.
Adds increment, decrement operators for all classes.
Fixes bugs on empty sequences.
Renames many parameters.
Adds minor optimizations.
Adds Multicombination.GetRowsForPicks (startPicks, stopPicks).
Adds CopyTo (array) to all combinatorics.
Removes Multicombination.GetRows (picks, startRank).
Adds Permutation.Backtrack method.
Multicombination ranking constructor accepts unsorted data.
Combination ranking constructor accepts unsorted data.
Fixes numeric overflow bug in Combination.Rank setter.
Fixes missing numeric overflow checks in Product constructors.
Fixes missing bounds checks in Product ranking constructor.
Removes increment and decrement operators.
Optimizes Combination.Rank setter.
Optimizes Multicombination.Rank setter.
Adds methods Combinatoric.BinomialCoefficient, Combinatoric.Factorial.
This release makes several changes to the Permutation class to add support for plain changes. There are also several breaking changes to improve API readability.
Adds Permutation.Choices property to support k-permutations.
Adds Permutation constructors to support k-permutations.
Adds property Permutation.PlainChange.
Adds property Permutation.Swaps.
Adds method Permutation.GetRowsForAllPicks.
Adds method Permutation.GetRowsOfPlainChanges.
Renames all Height properties to RowCount.
Renames Permutation.Width to Picks.
Renames Permutation.MaxWidth to MaxChoices.
Renames Permutation.GetRowsForAllWidths to GetRowsForAllChoices.
Removes Permutation (int, long) constructor.
Removes ICloneable base class and Clone methods from all combinatorics.
This release updates tooling to 2017. The new .NET Standard has been embraced for compatibility and future-proofing. Development now requires Visual Studio 2017 with the repository changed to Git. Binary now hosted at NuGet.org.
Renames namespace from Kw to Kaos.
Changes binary to .NET Standard 1.0 multitargeted to .NET 3.5, .NET 4.0.
Updates build environment to Visual Studio 2017.
Summary
Optimizes Permutation class for speed and allocations.
Changes Permutation comparisons to include the Choices property.
Changes iterator behavior to produce consistent operand side effects.
Changes thrown exceptions.
Applies strong name to assembly.
Details
Optimize Permutation class for speed and allocations
The Permutation class has seen the elimination of some temporary memory allocations in constructors taking int[], the Rank setter, and backtracking. This change also comes with slight performance improvements.
Change Permutation comparisons to include the Choices property
Previously, comparison of permutations did not compare the Choices property as in this snippet:
Console.WriteLine (new Permutation(choices:4,picks:3,rank:0)==new Permutation(choices:5,picks:3,rank:0)); /* Output: true */
This issue has been fixed and this example now correctly returns false.
Change iterator behavior to produce consistent operand side effects
Previous versions of iterators produced inconsistent side affects to their operands. New behavior is to synchronize the operand to the values yielded and restore their operand to its original state after the iteration is complete.
All iterators are affected:
Combination.GetRows, Combination.GetRowsForAllPicks
Multicombination.GetRows, Multicombination.GetRowsForPicks
Permutation.GetRows, Permutation.GetRowsForAllChoices, Permutation.GetRowsForAllPicks, Permutation.GetRowsOfPlainChanges
Product.GetRows
There is no impact for the typical scenario where the operand is not directly accessible as in this snippet:
foreach (var cn in new Combination (choices:3, picks:2).GetRowsForAllPicks()) Console.WriteLine (cn); /* Output: { 0 } { 1 } { 2 } { 0, 1 } { 0, 2 } { 1, 2 }*/
This change only impacts the atypical scenario where the operand is accessible independent of the yielded result such as in this snippet:
var cn0 = new Combination (choices:3, picks:2); foreach (var cn in cn0.GetRowsForAllPicks()) Console.WriteLine ($"cn={cn} cn0={cn0}"); Console.WriteLine ($"After complete, cn0={cn0}"); /* Output: cn={ 0 } cn0={ 0 } cn={ 1 } cn0={ 1 } cn={ 2 } cn0={ 2 } cn={ 0, 1 } cn0={ 0, 1 } cn={ 0, 2 } cn0={ 0, 2 } cn={ 1, 2 } cn0={ 1, 2 } After complete, cn0={ 0, 1 }*/
Change thrown exceptions
Minor changes have been made to exception throwing in:
Methods Permutation.Permute, Product.Permute
Constructors Permutation (int[]), Permutation (int[], int)
Where Permute methods threw IndexOutOfRangeException they now throw ArgumentException with a fail fast approach.
Where Permutation constructors taking an element array threw IndexOutOfRangeException they now throw ArgumentException.
Apply strong name to assembly
Strong names signing is necessary for installation into the Global Assembly Cache. As a convenience, an installer has been provided for this purpose.