From 2c22412269ccfb551a27fd8081712b46c243cbac Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Thu, 22 Jul 2004 23:06:03 +0000 Subject: [PATCH 1/1] synced to 1.2 (typos, better ncmul::degree() and ::coeff()) --- ginac/clifford.cpp | 2 +- ginac/container.h | 2 +- ginac/mul.cpp | 2 +- ginac/ncmul.cpp | 11 ++++++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 2a78d1a3..f8d503ff 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -459,7 +459,7 @@ ex clifford::eval_ncmul(const exvector & v) const bool something_changed = false; int sign = 1; - // Anticommute gamma5/L/R's to the front + // Anticommutate gamma5/L/R's to the front if (s.size() >= 2) { exvector::iterator first = s.begin(), next_to_last = s.end() - 2; while (true) { diff --git a/ginac/container.h b/ginac/container.h index 6161a20b..a3fc3989 100644 --- a/ginac/container.h +++ b/ginac/container.h @@ -187,7 +187,7 @@ public: } container(const ex & p1, const ex & p2, const ex & p3, - const ex & p4) : inherited(get_tinfo()) + const ex & p4) : inherited(get_tinfo()) { setflag(get_default_flags()); reserve(this->seq, 4); diff --git a/ginac/mul.cpp b/ginac/mul.cpp index dc9165b9..2b20e9fc 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -672,7 +672,7 @@ int mul::compare_same_type(const basic & other) const unsigned mul::return_type() const { if (seq.empty()) { - // mul without factors: should not happen, but commutes + // mul without factors: should not happen, but commutates return return_types::commutative; } diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index ccc91c49..abad2d16 100644 --- a/ginac/ncmul.cpp +++ b/ginac/ncmul.cpp @@ -190,6 +190,9 @@ ex ncmul::expand(unsigned options) const int ncmul::degree(const ex & s) const { + if (is_equal(ex_to(s))) + return 1; + // Sum up degrees of factors int deg_sum = 0; exvector::const_iterator i = seq.begin(), end = seq.end(); @@ -202,6 +205,9 @@ int ncmul::degree(const ex & s) const int ncmul::ldegree(const ex & s) const { + if (is_equal(ex_to(s))) + return 1; + // Sum up degrees of factors int deg_sum = 0; exvector::const_iterator i = seq.begin(), end = seq.end(); @@ -214,6 +220,9 @@ int ncmul::ldegree(const ex & s) const ex ncmul::coeff(const ex & s, int n) const { + if (is_equal(ex_to(s))) + return n==1 ? _ex1 : _ex0; + exvector coeffseq; coeffseq.reserve(seq.size()); @@ -535,7 +544,7 @@ unsigned ncmul::return_type() const ++i; } // all factors checked - GINAC_ASSERT(!all_commutative); // not all factors should commute, because this is a ncmul(); + GINAC_ASSERT(!all_commutative); // not all factors should commutate, because this is a ncmul(); return all_commutative ? return_types::commutative : return_types::noncommutative; } -- 2.44.0