]> www.ginac.de Git - ginac.git/blobdiff - ginac/basic.cpp
documentation update
[ginac.git] / ginac / basic.cpp
index 16d0dfddafe37419f7e2fe911c1e5afa07cd2579..92bd16053d8e921d35b3b26ee323545bd100e7ae 100644 (file)
@@ -232,7 +232,7 @@ bool basic::has(const ex & other) const
 
 /** Construct new expression by applying the specified function to all
  *  sub-expressions (one level only, not recursively). */
-ex basic::map(map_func f) const
+ex basic::map(map_function & f) const
 {
        unsigned num = nops();
        if (num == 0)
@@ -265,7 +265,7 @@ ex basic::coeff(const ex & s, int n) const
        return n==0 ? *this : _ex0();
 }
 
-/** Sort expression in terms of powers of some object(s).
+/** Sort expanded expression in terms of powers of some object(s).
  *  @param s object(s) to sort in
  *  @param distributed recursive or distributed form (only used when s is a list) */
 ex basic::collect(const ex & s, bool distributed) const
@@ -363,13 +363,17 @@ ex basic::evalf(int level) const
        return *this;
 }
 
-/** Evaluate sums and products of matrices. */
+/** Function object to be applied by basic::evalm(). */
+struct evalm_map_function : public map_function {
+       ex operator()(const ex & e) { return GiNaC::evalm(e); }
+} fcn;
+/** Evaluate sums, products and integer powers of matrices. */
 ex basic::evalm(void) const
 {
        if (nops() == 0)
                return *this;
        else
-               return map(GiNaC::evalm);
+               return map(fcn);
 }
 
 /** Perform automatic symbolic evaluations on indexed expression that
@@ -732,6 +736,7 @@ void basic::ensure_if_modifiable(void) const
 {
        if (this->refcount>1)
                throw(std::runtime_error("cannot modify multiply referenced object"));
+       clearflag(status_flags::hash_calculated);
 }
 
 //////////