From: Richard Kreckel Date: Wed, 25 Nov 2015 10:22:34 +0000 (+0100) Subject: Make specialized power::expand() helpers static member fuctions. X-Git-Tag: release_1-7-0~7^2~49 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=cec09e9ce4e1d10387d3551d1da0bf497ef3e03f Make specialized power::expand() helpers static member fuctions. The class power member functions expand_add(), expand_add_2(), and expand_mul() do not access any member variable of class power. (In fact, the only reason not to hide them entirely is that they invoke protected members of classs expairseq, add, and mul which requires them to be friends of these classes.) --- diff --git a/ginac/power.cpp b/ginac/power.cpp index b9090f81..e8f599d8 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -1103,9 +1103,10 @@ multinomial_coefficient(const std::vector & p) } // anonymous namespace + /** expand a^n where a is an add and n is a positive integer. * @see power::expand */ -ex power::expand_add(const add & a, long n, unsigned options) const +ex power::expand_add(const add & a, long n, unsigned options) { // The special case power(+(x,...y;x),2) can be optimized better. if (n==2) @@ -1248,7 +1249,7 @@ ex power::expand_add(const add & a, long n, unsigned options) const /** Special case of power::expand_add. Expands a^2 where a is an add. * @see power::expand_add */ -ex power::expand_add_2(const add & a, unsigned options) const +ex power::expand_add_2(const add & a, unsigned options) { epvector result; size_t result_size = (a.nops() * (a.nops()+1)) / 2; @@ -1319,7 +1320,7 @@ ex power::expand_add_2(const add & a, unsigned options) const /** Expand factors of m in m^n where m is a mul and n is an integer. * @see power::expand */ -ex power::expand_mul(const mul & m, const numeric & n, unsigned options, bool from_expand) const +ex power::expand_mul(const mul & m, const numeric & n, unsigned options, bool from_expand) { GINAC_ASSERT(n.is_integer()); diff --git a/ginac/power.h b/ginac/power.h index 9877ef57..3d5f1873 100644 --- a/ginac/power.h +++ b/ginac/power.h @@ -95,9 +95,9 @@ protected: void do_print_python_repr(const print_python_repr & c, unsigned level) const; void do_print_csrc_cl_N(const print_csrc_cl_N & c, unsigned level) const; - ex expand_add(const add & a, long n, unsigned options) const; - ex expand_add_2(const add & a, unsigned options) const; - ex expand_mul(const mul & m, const numeric & n, unsigned options, bool from_expand = false) const; + static ex expand_add(const add & a, long n, unsigned options); + static ex expand_add_2(const add & a, unsigned options); + static ex expand_mul(const mul & m, const numeric & n, unsigned options, bool from_expand = false); // member variables