Struct IntegerPartition
A lightweight representation of an enumerable partition of an ulong into specified fractional parts.
public readonly struct IntegerPartition : IReadOnlyCollection<ulong>, IEnumerable<ulong>, IEnumerable
- Implements
- Inherited Members
- Extension Methods
Constructors
IntegerPartition(ulong, params Fraction[])
Creates a new IntegerPartition instance.
public IntegerPartition(ulong value, params Fraction[] parts)
Parameters
Exceptions
- ArgumentOutOfRangeException
When any fractional part is less than 0.
Properties
Count
Number of parts.
public int Count { get; }
Property Value
Parts
Fractional parts.
public ReadOnlyArray<Fraction> Parts { get; }
Property Value
Quotient
Base value for each part.
public ulong Quotient { get; }
Property Value
Remainder
An auxiliary integer division remainder used for filling out irregularities.
public ulong Remainder { get; }
Property Value
Sum
Target sum which is the result of multiplication of the value to partition by the sum of all fractional parts. Sum of all resulting partitions will be equal to this value.
public ulong Sum { get; }
Property Value
Value
Value to partition.
public ulong Value { get; }
Property Value
Methods
GetEnumerator()
Creates a new IntegerPartition.Enumerator instance for this partition.
[Pure]
public IntegerPartition.Enumerator GetEnumerator()
Returns
- IntegerPartition.Enumerator
New IntegerPartition.Enumerator instance.
ToString()
Returns a string representation of this IntegerPartition instance.
[Pure]
public override string ToString()
Returns
- string
String representation.