43unsigned log2(
unsigned n);
49 return (
n & 0x80000000U) ? (
n << 1 | 0x00000001U) : (
n << 1);
59 if (std::less<const T *>()(a, b))
61 else if (std::less<const T *>()(b, a))
69 return n * UINT64_C(0x4f1bbcdd);
97 }
else if (!(*other < *i))
109 i = first; other = first;
118 }
else if (!(*i < *other))
128 }
while (first !=
last);
133template <
class It,
class Cmp,
class Swap>
147 bool swapped =
false;
149 if (comp(*i, *other)) {
154 }
else if (!comp(*other, *i))
166 i = first; other = first;
170 if (comp(*other, *i)) {
175 }
else if (!comp(*i, *other))
185 }
while (first !=
last);
191template <
class It,
class Cmp,
class Swap>
204 bool swapped =
false;
206 if (comp(*i, *other)) {
221 i = first; other = first;
225 if (comp(*other, *i)) {
238 }
while (first !=
last);
242template <
class It,
class Swap>
245 unsigned num =
last - first;
247 if (first == new_first || num < 2)
250 unsigned num1 = new_first - first, num2 =
last - new_first;
252 It a = first, b = new_first;
263 It a = new_first, b =
last;
267 }
while (a != first);
285 std::vector<unsigned>
x;
289 :
x(m_+1),
n(n_),
m(m_)
291 for (
unsigned k=1;
k<
m; ++
k)
307 unsigned f =
x[
k] + 1;
336 const std::vector<unsigned>&
get()
const
339 for (
unsigned i = 0; i <
m -
mpgen.
m; ++i)
342 for (
unsigned i =
m -
mpgen.
m; i <
m; ++i)
374 const std::vector<unsigned>&
get()
const
377 for (
unsigned i = 0; i <
mpgen.
m; ++i)
414 explicit coolmulti(
const std::vector<unsigned>& partition)
417 for (
unsigned n = 0;
n < partition.size(); ++
n) {
456 for (
unsigned i=1; i<partition.size(); ++i)
459 const std::vector<unsigned>&
get()
const
464 while (it !=
nullptr) {
527extern const ex
_ex_9;
529extern const ex
_ex_8;
531extern const ex
_ex_7;
533extern const ex
_ex_6;
535extern const ex
_ex_5;
537extern const ex
_ex_4;
539extern const ex
_ex_3;
541extern const ex
_ex_2;
543extern const ex
_ex_1;
578extern const ex
_ex10;
580extern const ex
_ex11;
582extern const ex
_ex12;
584extern const ex
_ex15;
586extern const ex
_ex18;
588extern const ex
_ex20;
590extern const ex
_ex24;
592extern const ex
_ex25;
594extern const ex
_ex30;
596extern const ex
_ex48;
598extern const ex
_ex60;
605#define DEFAULT_CTOR(classname) \
606classname::classname() { setflag(status_flags::evaluated | status_flags::expanded); }
608#define DEFAULT_COMPARE(classname) \
609int classname::compare_same_type(const basic & other) const \
615#define DEFAULT_PRINT(classname, text) \
616void classname::do_print(const print_context & c, unsigned level) const \
621#define DEFAULT_PRINT_LATEX(classname, text, latex) \
622DEFAULT_PRINT(classname, text) \
623void classname::do_print_latex(const print_latex & c, unsigned level) const \
Assertion macro definition.
Base class for generating all bounded combinatorial partitions of an integer n with exactly m parts i...
basic_partition_generator(unsigned n_, unsigned m_)
Generate all compositions of a partition of an integer n, starting with the compositions which has no...
std::vector< unsigned > composition
struct GiNaC::composition_generator::coolmulti cmgen
composition_generator(const std::vector< unsigned > &partition)
const std::vector< unsigned > & get() const
Exception class thrown by functions to signal unimplemented functionality so the expression may just ...
Generate all bounded combinatorial partitions of an integer n with exactly m parts (not including zer...
const std::vector< unsigned > & get() const
partition_generator(unsigned n_, unsigned m_)
std::vector< unsigned > partition
Generate all bounded combinatorial partitions of an integer n with exactly m parts (including zero pa...
partition_with_zero_parts_generator(unsigned n_, unsigned m_)
const std::vector< unsigned > & get() const
std::vector< unsigned > partition
const numeric * _num_24_p
const numeric * _num1_3_p
const numeric * _num_120_p
const numeric * _num_30_p
unsigned golden_ratio_hash(uintptr_t n)
Truncated multiplication with golden ratio, for computing hash values.
const numeric * _num_1_3_p
const numeric * _num_1_2_p
const numeric * _num_1_4_p
const numeric * _num1_2_p
const numeric * _num_10_p
const numeric * _num1_4_p
int compare_pointers(const T *a, const T *b)
Compare two pointers (just to establish some sort of canonical order).
const numeric * _num_11_p
const numeric * _num_12_p
const numeric * _num_48_p
unsigned log2(unsigned n)
Integer binary logarithm.
const numeric * _num_18_p
unsigned rotate_left(unsigned n)
Rotate bits of unsigned value by one bit to the left.
const numeric * _num_60_p
void shaker_sort(It first, It last, Cmp comp, Swap swapit)
const numeric * _num_15_p
void cyclic_permutation(It first, It last, It new_first, Swap swapit)
void swap(ex &e1, ex &e2)
int permutation_sign(It first, It last)
const numeric * _num120_p
const numeric * _num_20_p
const numeric * _num_25_p
const numeric multinomial_coefficient(const std::vector< unsigned > &p)
Compute the multinomial coefficient n!/(p1!*p2!*...*pk!) where n = p1+p2+...+pk, i....
void swap(GiNaC::ex &a, GiNaC::ex &b)
Specialization of std::swap() for ex objects.
mpartition2(unsigned n_, unsigned m_)
std::vector< unsigned > x
element(unsigned val, element *n)
coolmulti(const std::vector< unsigned > &partition)