Dear All, I would like that canonicalise_clifford(), clifford_prime() and remove_dirac_ONE() can handle matrices and lists (recursing into each entry). I applied a patch for that (ignoring re-identified lines from canonicalise_clifford()). Best, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/ --- GiNaC/ginac/clifford.cpp 2004-10-15 14:12:02.000000000 +0100 +++ clifford.cpp 2004-10-16 21:59:58.000000000 +0100 @@ -939,6 +939,12 @@ ex canonicalize_clifford(const ex & e) { + pointer_to_map_function fcn(canonicalize_clifford); + + if (is_a<matrix>(e) // || is_a<pseries>(e) || is_a<integral>(e) + || is_a<lst>(e)) { + return e.map(fcn); + } else { // Scan for any ncmul objects exmap srl; ex aux = e.to_rational(srl); @@ -990,6 +996,7 @@ } } return aux.subs(srl, subs_options::no_pattern).simplify_indexed(); + } } ex clifford_prime(const ex & e) @@ -997,9 +1004,8 @@ pointer_to_map_function fcn(clifford_prime); if (is_a<clifford>(e) && is_a<cliffordunit>(e.op(0))) { return -e; - } else if (is_a<add>(e)) { - return e.map(fcn); - } else if (is_a<ncmul>(e)) { + } else if (is_a<add>(e) || is_a<ncmul>(e) // || is_a<pseries>(e) || is_a<integral>(e) + || is_a<matrix>(e) || is_a<lst>(e)) { return e.map(fcn); } else if (is_a<power>(e)) { return pow(clifford_prime(e.op(0)), e.op(1)); @@ -1012,11 +1018,8 @@ pointer_to_map_function fcn(remove_dirac_ONE); if (is_a<clifford>(e) && is_a<diracone>(e.op(0))) { return 1; - } else if (is_a<add>(e)) { - return e.map(fcn); - } else if (is_a<ncmul>(e)) { - return e.map(fcn); - } else if (is_a<mul>(e)) { + } else if (is_a<add>(e) || is_a<ncmul>(e) || is_a<mul>(e) // || is_a<pseries>(e) || is_a<integral>(e) + || is_a<matrix>(e) || is_a<lst>(e)) { return e.map(fcn); } else if (is_a<power>(e)) { return pow(remove_dirac_ONE(e.op(0)), e.op(1));
Hi, On Sat, Oct 16, 2004 at 10:09:43PM +0100, Vladimir V. Kisil wrote:
Dear All,
I would like that canonicalise_clifford(), clifford_prime() and remove_dirac_ONE() can handle matrices and lists (recursing into each entry).
I applied a patch for that (ignoring re-identified lines from canonicalise_clifford()).
Patch has been applied. Thanks! Jens
participants (2)
-
Jens Vollinga
-
Vladimir V. Kisil