]> www.ginac.de Git - ginac.git/commitdiff
Make specialized power::expand() helpers static member fuctions.
authorRichard Kreckel <kreckel@ginac.de>
Wed, 25 Nov 2015 10:22:34 +0000 (11:22 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Wed, 25 Nov 2015 10:22:34 +0000 (11:22 +0100)
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.)

ginac/power.cpp
ginac/power.h

index b9090f818e818cdc259a5753a4e1c16030b9b850..e8f599d88abe08078f15faf2fb3db9a034347178 100644 (file)
@@ -1103,9 +1103,10 @@ multinomial_coefficient(const std::vector<int> & 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());
 
index 9877ef57a74173bb5246c6b440aa9b0362885808..3d5f187333171c5f1ff110f4940e39de3b0dfe82 100644 (file)
@@ -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