|
numeric
|
Computer integer partitions. More...
#include <IntegerPartitioning.hpp>
Public Types | |
| typedef std::map< size_t, std::set< IntegerPartition > > | PartitionsMap |
Public Member Functions | |
| void | compute (size_t number) |
| std::string | toString () const |
| PartitionsMap | getPartitionsMap () const |
Static Public Member Functions | |
| static std::string | toString (const IntegerPartition &partition) |
| static std::string | toString (const std::vector< IntegerPartition > &partitionList) |
| static size_t | multiplicity (const IntegerPartition &partition, int value) |
Computer integer partitions.
Utitility class that allows to compute all integer partitions of a given integer It uses the existing algorithm of Jerome Kelleher: "Generating All Partitions: A Comparison Of Two Encodings", (Kelleher and O'Sullivan, 2009)
IntegerPartitioning ip; // compute all partitions: [1,1,1,1,1],[2,1,1,1], ... [5] ip.compute(5); IntegerPartitioning::PartitionsMap partitionsMap = ip.getPartitionsMap();
| typedef std::map<size_t, std::set< IntegerPartition > > numeric::IntegerPartitioning::PartitionsMap |
| void numeric::IntegerPartitioning::compute | ( | size_t | number | ) |
Compute all integer partitions up to a given size
| number | Generating All Partitions: A Comparison Of Two Encodings Jerome Kelleher, Barry O'Sullivan |
Translated from python and retrieved from http://jeromekelleher.net/partitions.php
|
inline |
Retrieve the partitions map
|
static |
Compute the multiplicity of a value in a given integer partition
| std::string numeric::IntegerPartitioning::toString | ( | ) | const |
Print all generated partitions
|
static |
Convert an integer partition to a string
|
static |
Convert an integer partition to a string
1.8.13