44unsigned log2(
unsigned n);
50 return (
n & 0x80000000U) ? (
n << 1 | 0x00000001U) : (
n << 1);
60 if (std::less<const T *>()(a, b))
62 else if (std::less<const T *>()(b, a))
70 return n * UINT64_C(0x4f1bbcdd);
98 }
else if (!(*other < *i))
110 i = first; other = first;
119 }
else if (!(*i < *other))
129 }
while (first !=
last);
134template <
class It,
class Cmp,
class Swap>
148 bool swapped =
false;
150 if (comp(*i, *other)) {
155 }
else if (!comp(*other, *i))
167 i = first; other = first;
171 if (comp(*other, *i)) {
176 }
else if (!comp(*i, *other))
186 }
while (first !=
last);
192template <
class It,
class Cmp,
class Swap>
205 bool swapped =
false;
207 if (comp(*i, *other)) {
222 i = first; other = first;
226 if (comp(*other, *i)) {
239 }
while (first !=
last);
243template <
class It,
class Swap>
246 unsigned num =
last - first;
248 if (first == new_first || num < 2)
251 unsigned num1 = new_first - first, num2 =
last - new_first;
253 It a = first, b = new_first;
264 It a = new_first, b =
last;
268 }
while (a != first);
286 std::vector<unsigned>
x;
290 :
x(m_+1),
n(n_),
m(m_)
292 for (
unsigned k=1;
k<
m; ++
k)
308 unsigned f =
x[
k] + 1;
337 const std::vector<unsigned>&
get()
const
340 for (
unsigned i = 0; i <
m -
mpgen.
m; ++i)
343 for (
unsigned i =
m -
mpgen.
m; i <
m; ++i)
375 const std::vector<unsigned>&
get()
const
378 for (
unsigned i = 0; i <
mpgen.
m; ++i)
415 explicit coolmulti(
const std::vector<unsigned>& partition)
418 for (
unsigned n = 0;
n < partition.size(); ++
n) {
437 before_k->
next =
k->next;
457 for (
unsigned i=1; i<partition.size(); ++i)
460 const std::vector<unsigned>&
get()
const
465 while (it !=
nullptr) {
528extern const ex
_ex_9;
530extern const ex
_ex_8;
532extern const ex
_ex_7;
534extern const ex
_ex_6;
536extern const ex
_ex_5;
538extern const ex
_ex_4;
540extern const ex
_ex_3;
542extern const ex
_ex_2;
544extern const ex
_ex_1;
579extern const ex
_ex10;
581extern const ex
_ex11;
583extern const ex
_ex12;
585extern const ex
_ex15;
587extern const ex
_ex18;
589extern const ex
_ex20;
591extern const ex
_ex24;
593extern const ex
_ex25;
595extern const ex
_ex30;
597extern const ex
_ex48;
599extern const ex
_ex60;
606#define DEFAULT_CTOR(classname) \
607classname::classname() { setflag(status_flags::evaluated | status_flags::expanded); }
609#define DEFAULT_COMPARE(classname) \
610int classname::compare_same_type(const basic & other) const \
616#define DEFAULT_PRINT(classname, text) \
617void classname::do_print(const print_context & c, unsigned level) const \
622#define DEFAULT_PRINT_LATEX(classname, text, latex) \
623DEFAULT_PRINT(classname, text) \
624void 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)