X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fncmul.cpp;h=abad2d1616c910a180c5cfa9c7b42260d6839aaf;hp=3bc8b2145766e2755e6cc8060e10a9c892d2f4d2;hb=d7d0bcda91b647db9588f3aa1a465f1570d088c4;hpb=23acc666fcef311fd97092aee7f8c55e80395351 diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index 3bc8b214..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()); @@ -467,7 +476,7 @@ ex ncmul::conjugate() const return exprseq::conjugate(); } - if (return_type_tinfo() & 0xffffff00U != TINFO_clifford) { + if ((return_type_tinfo() & 0xffffff00U) != TINFO_clifford) { return exprseq::conjugate(); } @@ -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; }