]> www.ginac.de Git - ginac.git/commitdiff
synced to 1.2 (typos, better ncmul::degree() and ::coeff())
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 22 Jul 2004 23:06:03 +0000 (23:06 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 22 Jul 2004 23:06:03 +0000 (23:06 +0000)
ginac/clifford.cpp
ginac/container.h
ginac/mul.cpp
ginac/ncmul.cpp

index 2a78d1a39db00635c6fb4846316c8a85e11ee19f..f8d503ff6e68ea15f8bdcd8fdc107d85e72f2081 100644 (file)
@@ -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) {
index 6161a20b9504c50b6997d78ea313fbd6faaf8d22..a3fc3989e19da130926dd943c75647148c1bc4ce 100644 (file)
@@ -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);
index dc9165b928ed6e36af4bbda7c0f037c93effad35..2b20e9fca917c5ec9877400e6e5ee8b7607b6df8 100644 (file)
@@ -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;
        }
        
index ccc91c490d4be13f853739e61b8d423c076e6fe4..abad2d1616c910a180c5cfa9c7b42260d6839aaf 100644 (file)
@@ -190,6 +190,9 @@ ex ncmul::expand(unsigned options) const
 
 int ncmul::degree(const ex & s) const
 {
+       if (is_equal(ex_to<basic>(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<basic>(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<basic>(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;
 }