LIBINT
2.6.0
|
Iterates over all partitions of a non-negative integer into
nonnegative integers in reverse lexicographical order.
More...
#include <intpart_iter.h>
Public Types | |
typedef const Sequence & | value_type |
typedef Sequence::value_type | integer_type |
typedef std::make_unsigned< integer_type >::type | unsigned_integer_type |
typedef Sequence::size_type | size_type |
Public Member Functions | |
template<typename Seq = Sequence> | |
FixedOrderedIntegerPartitionIterator (unsigned_integer_type n, typename std::enable_if< detail::has_static_size< Seq >::value >::type *=nullptr) | |
FixedOrderedIntegerPartitionIterator (unsigned_integer_type n, size_type k) | |
intmax_t | range_size () const |
value_type | operator* () const |
const Sequence * | operator-> () const |
operator bool () const | |
bool | last () const |
void | next () |
update to the next partition in the range More... | |
Static Public Member Functions | |
template<typename Seq > | |
static intmax_t | rank (const Seq &part) |
returns the rank (index) of partition part in the partition range | |
Iterates over all partitions of a non-negative integer into
nonnegative integers in reverse lexicographical order.
E.g. partitions of into sets of
integers appear in this order: {2 0 0}, {1 1 0}, {1 0 1}, {0 2 0}, {0 1 1}, and {0 0 2}.
Sequence | integer sequence with dense storage (std::vector, std::array, and built-in array will work) |
|
inlineexplicit |
n | the positive integer to be partitioned |
k | the number of partitions, 1 or greater |
|
inline |
n | the positive integer to be partitioned |
k | the number of partitions, 1 or greater |
|
inline |
operator*
returns the last partition in the range References libint2::FixedOrderedIntegerPartitionIterator< Sequence, typename >::last().
Referenced by libint2::FixedOrderedIntegerPartitionIterator< Sequence, typename >::last(), and libint2::FixedOrderedIntegerPartitionIterator< Sequence, typename >::operator bool().
|
inline |
update to the next partition in the range
if | last() == true |
References libint2::FixedOrderedIntegerPartitionIterator< Sequence, typename >::next().
Referenced by libint2::FixedOrderedIntegerPartitionIterator< Sequence, typename >::next().
|
inline |
operator*
returns the last partition in the range References libint2::FixedOrderedIntegerPartitionIterator< Sequence, typename >::last().
|
inline |