Table of Contents

Struct IntegerPartition

Namespace
LfrlAnvil.Numerics
Assembly
LfrlAnvil.Core.dll

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

value ulong

Value to partition.

parts Fraction[]

Fractional parts.

Exceptions

ArgumentOutOfRangeException

When any fractional part is less than 0.

Properties

Count

Number of parts.

public int Count { get; }

Property Value

int

Parts

Fractional parts.

public ReadOnlyArray<Fraction> Parts { get; }

Property Value

ReadOnlyArray<Fraction>

Quotient

Base value for each part.

public ulong Quotient { get; }

Property Value

ulong

Remainder

An auxiliary integer division remainder used for filling out irregularities.

public ulong Remainder { get; }

Property Value

ulong

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

ulong

Value

Value to partition.

public ulong Value { get; }

Property Value

ulong

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.