removed obsolete files
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Tue, 6 Mar 2001 20:05:24 +0000 (20:05 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Tue, 6 Mar 2001 20:05:24 +0000 (20:05 +0000)
15 files changed:
check/exam_noncommut.cpp [deleted file]
ginac/clifford.cpp [deleted file]
ginac/clifford.h [deleted file]
ginac/color.cpp [deleted file]
ginac/color.h [deleted file]
ginac/coloridx.cpp [deleted file]
ginac/coloridx.h [deleted file]
ginac/isospin.cpp [deleted file]
ginac/isospin.h [deleted file]
ginac/lorentzidx.cpp [deleted file]
ginac/lorentzidx.h [deleted file]
ginac/lortensor.cpp [deleted file]
ginac/lortensor.h [deleted file]
ginac/simp_lor.cpp [deleted file]
ginac/simp_lor.h [deleted file]

diff --git a/check/exam_noncommut.cpp b/check/exam_noncommut.cpp
deleted file mode 100644 (file)
index a6137aa..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/** @file exam_noncommut.cpp
- *
- *  Here we test manipulations on GiNaC's lortensors. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "exams.h"
-
-static unsigned lortensor_check1(void)
-{
-       // checks simple identities of the metric tensor!
-       
-       unsigned result = 0;
-       lorentzidx mu("mu"), nu("nu");
-       ex e1, e2, e3, e4, e5, e6;
-       e1 = lortensor_g(mu,nu);
-       e2 = lortensor_g(nu,mu);
-       e3 = e1 - e2; // g(~mu,~nu) - g(~nu,~mu) = 0 !
-       e4 = lortensor_g(mu,mu.toggle_covariant());
-       e5 = lortensor_g(mu.toggle_covariant(),mu);
-       e6 = e4 - e5; // g(~mu,_mu) - g(_mu,~mu) = 0!
-       if (!e3.is_zero()) {
-               clog << e1 << "-" << e2 << " erroneously returned "
-                    << e3 << " instead of 0" << endl;
-               ++result;
-       }
-       if (!e6.is_zero()) {
-               clog << e4 << "-" << e5 << " erroneously returned "
-                    << e6 << " instead of 0" << endl;
-               ++result;
-       }
-       
-       return result;
-}
-
-#if 0  // this will change
-static unsigned lortensor_check2(void)
-{
-       // checks simple contraction properties of an arbitrary (symmetric!) rankn lortensor!
-       
-       unsigned result = 0;
-       lorentzidx mu("mu"), nu("nu"), rho("rho");
-       ex e1, e2, e3, e4, e5, e6, e7, e8, e9, e10;
-       e1 = lortensor_g(mu,nu);
-       e2 = lortensor_g(nu,mu);
-       e3 = lortensor_rank1("p",mu.toggle_covariant());
-       e4 = lortensor_rank1("p",nu);
-       e5 = e3 * e1 - e3 * e2; // p_mu g(~mu,~nu) - p_mu g(~nu,~mu) = 0!
-       e6 = simplify_lortensor(e3 * e1) - e4; // p~nu - p~nu = 0!
-       e7 = lortensor_g(nu,rho);
-       e8 = lortensor_rank2("F",mu.toggle_covariant(),nu.toggle_covariant());
-       e9 = lortensor_rank2("F",mu.toggle_covariant(),rho);
-       e10 = simplify_lortensor(e8 * e7) - e9; // F(_mu,_nu) g(~nu,~rho) - F(_mu,~rho) = 0!
-       if (!e5.is_zero()) {
-               clog << e3 << "*" << e1 << "-" << e3 << "*" << e2 << " erroneously returned "
-                    << e5 << " instead of 0" << endl;
-               ++result;
-       }
-       if (!e6.is_zero()) {    
-               clog << " simplify_lortensor(e3 * e1)" << "-" << e4 << " erroneously returned"
-                    << e6 << " instead of 0" << endl;
-               ++result;
-       }
-       if (!e10.is_zero()) {           
-               clog << " simplify_lortensor(e8 * e7)" << "-" << e9 << " erroneously returned"
-                    << e10 << " instead of 0" << endl;
-               ++result;
-       }
-       
-       return result;
-}
-#endif
-
-unsigned exam_noncommut(void)
-{
-       unsigned result = 0;
-       
-       cout << "examining behaviour of noncommutative objects" << flush;
-       clog << "----------behaviour of noncommutative objects:" << endl;
-       
-       result += lortensor_check1();  cout << '.' << flush;
-#if 0
-       result += lortensor_check2();  cout << '.' << flush;
-#endif
-       if (!result) {
-               cout << " passed " << endl;
-               clog << "(no output)" << endl;
-       } else {
-               cout << " failed " << endl;
-       }
-       
-       return result;
-}
diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp
deleted file mode 100644 (file)
index a3f26c9..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/** @file clifford.cpp
- *
- *  Implementation of GiNaC's clifford objects.
- *  No real implementation yet, to be done.     */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string>
-
-#include "clifford.h"
-#include "ex.h"
-#include "ncmul.h"
-#include "archive.h"
-#include "utils.h"
-#include "debugmsg.h"
-
-namespace GiNaC {
-
-GINAC_IMPLEMENT_REGISTERED_CLASS(clifford, lortensor)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-clifford::clifford()
-{
-       debugmsg("clifford default constructor",LOGLEVEL_CONSTRUCT);
-       tinfo_key = TINFO_clifford;
-}
-
-// protected
-
-void clifford::copy(const clifford & other)
-{
-       inherited::copy(other);
-}
-
-void clifford::destroy(bool call_parent)
-{
-       if (call_parent) inherited::destroy(call_parent);
-}
-
-//////////
-// other constructors
-//////////
-
-// public
-
-clifford::clifford(const std::string & n, const ex & mu) : inherited(lortensor_symbolic, n, mu)
-{
-       debugmsg("clifford constructor from string,ex",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_clifford;
-}
-
-clifford::clifford(const std::string & n, const exvector & iv) : inherited(lortensor_symbolic, n, iv)
-{
-       debugmsg("clifford constructor from string,exvector", LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       tinfo_key=TINFO_clifford;
-}
-
-clifford::clifford(const std::string & n, exvector *ivp) : inherited(lortensor_symbolic, n, *ivp)
-{
-       debugmsg("clifford constructor from string,exvector", LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       tinfo_key=TINFO_clifford;
-}
-
-//////////
-// archiving
-//////////
-
-/** Construct object from archive_node. */
-clifford::clifford(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
-       debugmsg("clifford constructor from archive_node", LOGLEVEL_CONSTRUCT);
-}
-
-/** Unarchive the object. */
-ex clifford::unarchive(const archive_node &n, const lst &sym_lst)
-{
-       return (new clifford(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void clifford::archive(archive_node &n) const
-{
-       inherited::archive(n);
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-void clifford::printraw(std::ostream & os) const
-{
-       debugmsg("clifford printraw",LOGLEVEL_PRINT);
-       os << "clifford(" << "indices=";
-       printrawindices(os);
-       os << ",hash=" << hashvalue << ",flags=" << flags << ")";
-}
-
-void clifford::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("clifford printtree",LOGLEVEL_PRINT);
-       os << std::string(indent,' ') << " (clifford): "
-          << seq.size() << "indices=";
-       printtreeindices(os, indent);
-       os << ", hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void clifford::print(std::ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("clifford print",LOGLEVEL_PRINT);
-       os << name;
-       printindices(os);
-}
-
-bool clifford::info(unsigned inf) const
-{
-       return inherited::info(inf);
-}
-
-// protected
-
-int clifford::compare_same_type(const basic & other) const
-{
-       GINAC_ASSERT(is_of_type(other,clifford));
-       // only compare indices
-       return exprseq::compare_same_type(other);
-}
-
-bool clifford::is_equal_same_type(const basic & other) const
-{
-       GINAC_ASSERT(is_of_type(other,clifford));
-       // only compare indices
-       return exprseq::is_equal_same_type(other);
-}
-
-ex clifford::thisexprseq(const exvector & v) const
-{
-       return clifford(name, v);
-}
-
-ex clifford::thisexprseq(exvector *vp) const
-{
-       return clifford(name, vp);
-}
-
-ex clifford::simplify_ncmul(const exvector & v) const
-{
-       return simplified_ncmul(v);
-}
-
-//////////
-// friend functions
-//////////
-
-/** Construct an object representing a Dirac gamma matrix. The index must
- *  be of class lorentzidx.
- *
- *  @param mu Index
- *  @return newly constructed object */
-clifford clifford_gamma(const ex & mu)
-{
-       return clifford("gamma", mu);
-}
-
-} // namespace GiNaC
diff --git a/ginac/clifford.h b/ginac/clifford.h
deleted file mode 100644 (file)
index 86978e9..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/** @file clifford.h
- *
- *  Interface to GiNaC's clifford objects. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __GINAC_CLIFFORD_H__
-#define __GINAC_CLIFFORD_H__
-
-#include <string>
-#include "lortensor.h"
-
-namespace GiNaC {
-
-
-/** This class holds an object representing an element of the Clifford
- *  algebra (the Dirac gamma matrices). These objects only carry Lorentz
- *  indices. Spinor indices are always hidden in our implementation. */
-class clifford : public lortensor
-{
-       GINAC_DECLARE_REGISTERED_CLASS(clifford, lortensor)
-
-// friends
-
-       friend clifford clifford_gamma(const ex & mu);
-
-       // other constructors
-public:
-       clifford(const std::string & n, const ex & mu);
-       clifford(const std::string & n, const exvector & iv);
-       clifford(const std::string & n, exvector * ivp);
-
-       // functions overriding virtual functions from base classes
-public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
-       bool info(unsigned inf) const;
-       // ex eval(int level=0) const;
-protected:
-       bool is_equal_same_type(const basic & other) const;
-       ex simplify_ncmul(const exvector & v) const;
-       ex thisexprseq(const exvector & v) const;
-       ex thisexprseq(exvector * vp) const;
-
-       // new virtual functions which can be overridden by derived classes
-       // none
-       
-       // non-virtual functions in this class
-       // none
-
-       // member variables
-       // none
-};
-
-// global functions
-inline const clifford &ex_to_clifford(const ex &e)
-{
-       return static_cast<const clifford &>(*e.bp);
-}
-
-clifford clifford_gamma(const ex & mu);
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_CLIFFORD_H__
diff --git a/ginac/color.cpp b/ginac/color.cpp
deleted file mode 100644 (file)
index 9e355cb..0000000
+++ /dev/null
@@ -1,1034 +0,0 @@
-/** @file color.cpp
- *
- *  Implementation of GiNaC's color objects.
- *  No real implementation yet, to be done.     */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string>
-#include <list>
-#include <algorithm>
-#include <iostream>
-#include <stdexcept>
-
-#include "color.h"
-#include "ex.h"
-#include "coloridx.h"
-#include "ncmul.h"
-#include "numeric.h"
-#include "relational.h"
-#include "archive.h"
-#include "debugmsg.h"
-#include "utils.h"
-
-namespace GiNaC {
-
-GINAC_IMPLEMENT_REGISTERED_CLASS(color, indexed)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-color::color() : inherited(TINFO_color), type(invalid), representation_label(0)
-{
-       debugmsg("color default constructor",LOGLEVEL_CONSTRUCT);
-}
-
-// protected
-
-void color::copy(const color & other)
-{
-       inherited::copy(other);
-       type=other.type;
-       representation_label=other.representation_label;
-}
-
-void color::destroy(bool call_parent)
-{
-       if (call_parent) {
-               inherited::destroy(call_parent);
-       }
-}
-
-//////////
-// other constructors
-//////////
-
-// protected
-
-/** Construct object without any color index. This constructor is for internal
- *  use only. Use the color_ONE() function instead.
- *  @see color_ONE */
-color::color(color_types const t, unsigned rl) : type(t), representation_label(rl)
-{
-       debugmsg("color constructor from color_types,unsigned",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-       tinfo_key=TINFO_color;
-       GINAC_ASSERT(all_of_type_coloridx());
-}
-
-/** Construct object with one color index. This constructor is for internal
- *  use only. Use the color_T() function instead.
- *  @see color_T */
-color::color(color_types const t, const ex & i1, unsigned rl)
-  : inherited(i1), type(t), representation_label(rl)
-{
-       debugmsg("color constructor from color_types,ex,unsigned",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-       tinfo_key=TINFO_color;
-       GINAC_ASSERT(all_of_type_coloridx());
-}
-
-/** Construct object with two color indices. This constructor is for internal
- *  use only. Use the color_delta8() function instead.
- *  @see color_delta8 */
-color::color(color_types const t, const ex & i1, const ex & i2, unsigned rl)
-  : inherited(i1,i2), type(t), representation_label(rl)
-{
-       debugmsg("color constructor from color_types,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-       tinfo_key=TINFO_color;
-       GINAC_ASSERT(all_of_type_coloridx());
-}
-
-/** Construct object with three color indices. This constructor is for internal
- *  use only. Use the color_f(), color_d() and color_h() functions instead.
- *  @see color_f
- *  @see color_d
- *  @see color_h */
-color::color(color_types const t, const ex & i1, const ex & i2, const ex & i3,
-             unsigned rl) : inherited(i1,i2,i3), type(t), representation_label(rl)
-{
-       debugmsg("color constructor from color_types,ex,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-       tinfo_key=TINFO_color;
-       GINAC_ASSERT(all_of_type_coloridx());
-}
-
-/** Construct object with arbitrary number of color indices. This
- *  constructor is for internal use only. */
-color::color(color_types const t, const exvector & iv, unsigned rl)
-  : inherited(iv), type(t), representation_label(rl)
-{
-       debugmsg("color constructor from color_types,exvector,unsigned",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-       tinfo_key=TINFO_color;
-       GINAC_ASSERT(all_of_type_coloridx());
-}
-
-color::color(color_types const t, exvector * ivp, unsigned rl)
-  : inherited(ivp), type(t), representation_label(rl)
-{
-       debugmsg("color constructor from color_types,exvector *,unsigned",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-       tinfo_key=TINFO_color;
-       GINAC_ASSERT(all_of_type_coloridx());
-}
-
-//////////
-// archiving
-//////////
-
-/** Construct object from archive_node. */
-color::color(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
-       debugmsg("color constructor from archive_node", LOGLEVEL_CONSTRUCT);
-       unsigned int ty;
-       if (!(n.find_unsigned("type", ty)))
-               throw (std::runtime_error("unknown color type in archive"));
-       type = (color_types)ty;
-       if (!(n.find_unsigned("representation", representation_label)))
-               throw (std::runtime_error("unknown color representation label in archive"));
-}
-
-/** Unarchive the object. */
-ex color::unarchive(const archive_node &n, const lst &sym_lst)
-{
-       return (new color(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void color::archive(archive_node &n) const
-{
-       inherited::archive(n);
-       n.add_unsigned("type", type);
-       n.add_unsigned("representation", representation_label);
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-void color::printraw(std::ostream & os) const
-{
-       debugmsg("color printraw",LOGLEVEL_PRINT);
-       os << "color(type=" << (unsigned)type
-          << ",representation_label=" << representation_label
-          << ",indices=";
-       printrawindices(os);
-       os << ",hash=" << hashvalue << ",flags=" << flags << ")";
-}
-
-void color::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("color printtree",LOGLEVEL_PRINT);
-       os << std::string(indent,' ') << "color object: "
-          << "type=" << (unsigned)type
-          << ",representation_label=" << representation_label << ", ";
-       os << seq.size() << " indices" << std::endl;
-       printtreeindices(os,indent);
-       os << std::string(indent,' ') << "hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void color::print(std::ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("color print",LOGLEVEL_PRINT);
-       switch (type) {
-       case color_T:
-               os << "T";
-               if (representation_label!=0) {
-                       os << "^(" << representation_label << ")";
-               }
-               break;
-       case color_f:
-               os << "f";
-               break;
-       case color_d:
-               os << "d";
-               break;
-       case color_delta8:
-               os << "delta8";
-               break;
-       case color_ONE:
-               os << "color_ONE";
-               break;
-       case invalid:
-       default:
-               os << "INVALID_COLOR_OBJECT";
-               break;
-       }
-       printindices(os);
-}
-
-bool color::info(unsigned inf) const
-{
-       return inherited::info(inf);
-}
-
-#define CMPINDICES(A,B,C) ((idx1.get_value()==(A))&&(idx2.get_value()==(B))&&(idx3.get_value()==(C)))
-
-ex color::eval(int level) const
-{
-       // canonicalize indices
-       
-       bool antisymmetric=false;
-       
-       switch (type) {
-       case color_f:
-               antisymmetric=true; // no break here!
-       case color_d:
-       case color_delta8:
-               {
-                       exvector iv=seq;
-                       int sig=canonicalize_indices(iv,antisymmetric);
-                       if (sig!=INT_MAX) {
-                               // something has changed while sorting indices, more evaluations later
-                               if (sig==0) return _ex0();
-                               return ex(sig)*color(type,iv,representation_label);
-                       }
-               }
-               break;
-       default:
-               // nothing to canonicalize
-               break;
-       }
-
-       switch (type) {
-       case color_delta8:
-               {
-                       GINAC_ASSERT(seq.size()==2);
-                       const coloridx & idx1=ex_to_coloridx(seq[0]);
-                       const coloridx & idx2=ex_to_coloridx(seq[1]);
-                       
-                       // check for delta8_{a,a} where a is a symbolic index, replace by 8
-                       if ((idx1.is_symbolic())&&(idx1.is_equal_same_type(idx2))) {
-                               return ex(COLOR_EIGHT);
-                       }
-
-                       // check for delta8_{a,b} where a and b are numeric indices, replace by 0 or 1
-                       if ((!idx1.is_symbolic())&&(!idx2.is_symbolic())) {
-                               if ((idx1.get_value()!=idx2.get_value())) {
-                                       return _ex1();
-                               } else {
-                                       return _ex0();
-                               }
-                       }
-       }
-               break;
-       case color_d:
-               // check for d_{a,a,c} (=0) when a is symbolic
-               {
-                       GINAC_ASSERT(seq.size()==3);
-                       const coloridx & idx1=ex_to_coloridx(seq[0]);
-                       const coloridx & idx2=ex_to_coloridx(seq[1]);
-                       const coloridx & idx3=ex_to_coloridx(seq[2]);
-                       
-                       if (idx1.is_equal_same_type(idx2) && idx1.is_symbolic()) {
-                               return _ex0();
-                       } else if (idx2.is_equal_same_type(idx3) && idx2.is_symbolic()) {
-                               return _ex0();
-                       }
-                       
-                       // check for three numeric indices
-                       if (!(idx1.is_symbolic()||idx2.is_symbolic()||idx3.is_symbolic())) {
-                               GINAC_ASSERT(idx1.get_value()<=idx2.get_value());
-                               GINAC_ASSERT(idx2.get_value()<=idx3.get_value());
-                               if (CMPINDICES(1,4,6)||CMPINDICES(1,5,7)||CMPINDICES(2,5,6)||
-                                       CMPINDICES(3,4,4)||CMPINDICES(3,5,5)) {
-                                       return _ex1_2();
-                               } else if (CMPINDICES(2,4,7)||CMPINDICES(3,6,6)||CMPINDICES(3,7,7)) {
-                                       return -_ex1_2();
-                               } else if (CMPINDICES(1,1,8)||CMPINDICES(2,2,8)||CMPINDICES(3,3,8)) {
-                                       return 1/sqrt(numeric(3));
-                               } else if (CMPINDICES(8,8,8)) {
-                                       return -1/sqrt(numeric(3));
-                               } else if (CMPINDICES(4,4,8)||CMPINDICES(5,5,8)||CMPINDICES(6,6,8)||CMPINDICES(7,7,8)) {
-                                       return -1/(2*sqrt(numeric(3)));
-                               }
-                               return _ex0();
-                       }
-               }
-               break;
-       case color_f:
-               {
-                       GINAC_ASSERT(seq.size()==3);
-                       const coloridx & idx1=ex_to_coloridx(seq[0]);
-                       const coloridx & idx2=ex_to_coloridx(seq[1]);
-                       const coloridx & idx3=ex_to_coloridx(seq[2]);
-                       
-                       // check for three numeric indices
-                       if (!(idx1.is_symbolic()||idx2.is_symbolic()||idx3.is_symbolic())) {
-                               GINAC_ASSERT(idx1.get_value()<=idx2.get_value());
-                               GINAC_ASSERT(idx2.get_value()<=idx3.get_value());
-                               if (CMPINDICES(1,2,3)) {
-                                       return _ex1();
-                               } else if (CMPINDICES(1,4,7)||CMPINDICES(2,4,6)||
-                                          CMPINDICES(2,5,7)||CMPINDICES(3,4,5)) {
-                                       return _ex1_2();
-                               } else if (CMPINDICES(1,5,6)||CMPINDICES(3,6,7)) {
-                                       return -_ex1_2();
-                               } else if (CMPINDICES(4,5,8)||CMPINDICES(6,7,8)) {
-                                       return sqrt(numeric(3))/2;
-                               } else if (CMPINDICES(8,8,8)) {
-                                       return -1/sqrt(numeric(3));
-                               } else if (CMPINDICES(4,4,8)||CMPINDICES(5,5,8)||CMPINDICES(6,6,8)||CMPINDICES(7,7,8)) {
-                                       return -1/(2*sqrt(numeric(3)));
-                               }
-                               return _ex0();
-                       }
-                       break;
-               }
-       default:
-               // nothing to evaluate
-               break;
-       }
-       
-       return this->hold();
-}
-       
-// protected
-
-int color::compare_same_type(const basic & other) const
-{
-       GINAC_ASSERT(other.tinfo() == TINFO_color);
-       const color &o = static_cast<const color &>(other);
-
-       if (type != o.type) {
-               // different type
-               return type < o.type ? -1 : 1;
-       }
-
-       if (representation_label != o.representation_label) {
-               // different representation label
-               return representation_label < o.representation_label ? -1 : 1;
-       }
-
-       return inherited::compare_same_type(other);
-}
-
-bool color::is_equal_same_type(const basic & other) const
-{
-       GINAC_ASSERT(other.tinfo() == TINFO_color);
-       const color &o = static_cast<const color &>(other);
-
-       if (type != o.type) return false;
-       if (representation_label != o.representation_label) return false;
-       return inherited::is_equal_same_type(other);
-}
-
-#include <iostream>
-
-ex color::simplify_ncmul(const exvector & v) const
-{
-       // simplifications: contract delta8_{a,b} where possible
-       //                  sort delta8,f,d,T(rl=0),T(rl=1),...,ONE(rl=0),ONE(rl=1),...
-       //                  remove superfluous ONEs
-       
-       // contract indices of delta8_{a,b} if they are different and symbolic
-
-       exvector v_contracted=v;
-       unsigned replacements;
-       bool something_changed=false;
-
-       exvector::iterator it=v_contracted.begin();
-       while (it!=v_contracted.end()) {
-               // process only delta8 objects
-               if (is_ex_exactly_of_type(*it,color) && (ex_to_color(*it).type==color_delta8)) {
-                       color & d8=ex_to_nonconst_color(*it);
-                       GINAC_ASSERT(d8.seq.size()==2);
-                       const coloridx & first_idx=ex_to_coloridx(d8.seq[0]);
-                       const coloridx & second_idx=ex_to_coloridx(d8.seq[1]);
-                       // delta8_{a,a} should have been contracted in color::eval()
-                       GINAC_ASSERT((!first_idx.is_equal(second_idx))||(!first_idx.is_symbolic()));
-                       ex saved_delta8=*it; // save to restore it later
-
-                       // try to contract first index
-                       replacements=1;
-                       if (first_idx.is_symbolic()) {
-                               replacements = subs_index_in_exvector(v_contracted,first_idx,second_idx);
-                               if (replacements==1) {
-                                       // not contracted except in itself, restore delta8 object
-                                       *it=saved_delta8;
-                               } else {
-                                       // a contracted index should occur exactly twice
-                                       GINAC_ASSERT(replacements==2);
-                                       *it=_ex1();
-                                       something_changed=true;
-                               }
-                       }
-
-                       // try second index only if first was not contracted
-                       if ((replacements==1)&&(second_idx.is_symbolic())) {
-                               // first index not contracted, *it is guaranteed to be the original delta8 object
-                               replacements = subs_index_in_exvector(v_contracted,second_idx,first_idx);
-                               if (replacements==1) {
-                                       // not contracted except in itself, restore delta8 object
-                                       *it=saved_delta8;
-                               } else {
-                                       // a contracted index should occur exactly twice
-                                       GINAC_ASSERT(replacements==2);
-                                       *it=_ex1();
-                                       something_changed=true;
-                               }
-                       }
-               }
-               ++it;
-       }
-
-       if (something_changed) {
-               // do more simplifications later
-               return nonsimplified_ncmul(v_contracted);
-       }
-
-       // there were no indices to contract
-       // sort delta8,f,d,T(rl=0),T(rl=1),...,ONE(rl=0),ONE(rl=1),...,unknown
-       // (if there is at least one unknown object, all Ts will be unknown to not change the order)
-       
-       exvector delta8vec;
-       exvector fvec;
-       exvector dvec;
-       exvectorvector Tvecs;
-       Tvecs.resize(MAX_REPRESENTATION_LABELS);
-       exvectorvector ONEvecs;
-       ONEvecs.resize(MAX_REPRESENTATION_LABELS);
-       exvector unknownvec;
-       
-       split_color_string_in_parts(v,delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec);
-
-       // d_{a,k,l} f_{b,k,l}=0 (includes case a=b)
-       if ((dvec.size()>=1)&&(fvec.size()>=1)) {
-               for (exvector::iterator it1=dvec.begin(); it1!=dvec.end(); ++it1) {
-                       for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) {
-                               GINAC_ASSERT(is_ex_exactly_of_type(*it1,color));
-                               GINAC_ASSERT(is_ex_exactly_of_type(*it2,color));
-                               const color & col1=ex_to_color(*it1);
-                               const color & col2=ex_to_color(*it2);
-                               exvector iv_intersect=idx_intersect(col1.seq,col2.seq);
-                               if (iv_intersect.size()>=2) return _ex0();
-                       }
-               }
-       }
-       
-       // d_{a,k,l} d_{b,k,l}=5/3 delta8_{a,b} (includes case a=b)
-       if (dvec.size()>=2) {
-               for (exvector::iterator it1=dvec.begin(); it1!=dvec.end()-1; ++it1) {
-                       for (exvector::iterator it2=it1+1; it2!=dvec.end(); ++it2) {
-                               GINAC_ASSERT(is_ex_exactly_of_type(*it1,color));
-                               GINAC_ASSERT(is_ex_exactly_of_type(*it2,color));
-                               const color & col1=ex_to_color(*it1);
-                               const color & col2=ex_to_color(*it2);
-                               exvector iv_intersect=idx_intersect(col1.seq,col2.seq);
-                               if (iv_intersect.size()>=2) {
-                                       if (iv_intersect.size()==3) {
-                                               *it1=numeric(40)/numeric(3);
-                                               *it2=_ex1();
-                                       } else {
-                                               int dummy; // sign unimportant, since symmetric
-                                               ex idx1=permute_free_index_to_front(col1.seq,iv_intersect,&dummy);
-                                               ex idx2=permute_free_index_to_front(col2.seq,iv_intersect,&dummy);
-                                               *it1=numeric(5)/numeric(3)*color(color_delta8,idx1,idx2);
-                                               *it2=_ex1();
-                                       }
-                                       return nonsimplified_ncmul(recombine_color_string(
-                                                  delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
-                               }
-                       }
-               }
-       }
-
-       // f_{a,k,l} f_{b,k,l}=3 delta8_{a,b} (includes case a=b)
-       if (fvec.size()>=2) {
-               for (exvector::iterator it1=fvec.begin(); it1!=fvec.end()-1; ++it1) {
-                       for (exvector::iterator it2=it1+1; it2!=fvec.end(); ++it2) {
-                               GINAC_ASSERT(is_ex_exactly_of_type(*it1,color));
-                               GINAC_ASSERT(is_ex_exactly_of_type(*it2,color));
-                               const color & col1=ex_to_color(*it1);
-                               const color & col2=ex_to_color(*it2);
-                               exvector iv_intersect=idx_intersect(col1.seq,col2.seq);
-                               if (iv_intersect.size()>=2) {
-                                       if (iv_intersect.size()==3) {
-                                               *it1=numeric(24);
-                                               *it2=_ex1();
-                                       } else {
-                                               int sig1, sig2;
-                                               ex idx1=permute_free_index_to_front(col1.seq,iv_intersect,&sig1);
-                                               ex idx2=permute_free_index_to_front(col2.seq,iv_intersect,&sig2);
-                                               *it1=numeric(sig1*sig2*5)/numeric(3)*color(color_delta8,idx1,idx2);
-                                               *it2=_ex1();
-                                       }
-                                       return nonsimplified_ncmul(recombine_color_string(
-                                                  delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
-                               }
-                       }
-               }
-       }
-
-       // d_{a,b,c} T_b T_c = 5/6 T_a
-       // f_{a,b,c} T_b T_c = 3/2 I T_a
-       for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
-               if ((Tvecs[rl].size()>=2)&&((dvec.size()>=1)||(fvec.size()>=1))) {
-                       for (exvector::iterator it1=Tvecs[rl].begin(); it1!=Tvecs[rl].end()-1; ++it1) {
-                               exvector iv;
-                               GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)&&ex_to_color(*it1).type==color_T);
-                               GINAC_ASSERT(is_ex_exactly_of_type(*(it1+1),color)&&ex_to_color(*(it1+1)).type==color_T);
-                               iv.push_back(ex_to_color(*it1).seq[0]);
-                               iv.push_back(ex_to_color(*(it1+1)).seq[0]);
-                               
-                               // d_{a,b,c} T_b T_c = 5/6 T_a
-                               for (exvector::iterator it2=dvec.begin(); it2!=dvec.end(); ++it2) {
-                                       GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_d);
-                                       const color & dref=ex_to_color(*it2);
-                                       exvector iv_intersect=idx_intersect(dref.seq,iv);
-                                       if (iv_intersect.size()==2) {
-                                               int dummy; // sign unimportant, since symmetric
-                                               ex free_idx=permute_free_index_to_front(dref.seq,iv,&dummy);
-                                               *it1=color(color_T,free_idx,rl);
-                                               *(it1+1)=color(color_ONE,rl);
-                                               *it2=numeric(5)/numeric(6);
-                                               return nonsimplified_ncmul(recombine_color_string(
-                                                          delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
-                                       }
-                               }
-
-                               // f_{a,b,c} T_b T_c = 3/2 I T_a
-                               for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) {
-                                       GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_f);
-                                       const color & fref=ex_to_color(*it2);
-                                       exvector iv_intersect=idx_intersect(fref.seq,iv);
-                                       if (iv_intersect.size()==2) {
-                                               int sig;
-                                               ex free_idx=permute_free_index_to_front(fref.seq,iv,&sig);
-                                               *it1=color(color_T,free_idx,rl);
-                                               *(it1+1)=color(color_ONE,rl);
-                                               *it2=numeric(sig*3)/numeric(2)*I;
-                                               return nonsimplified_ncmul(recombine_color_string(
-                                                          delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
-                                       }
-                               }
-                       }
-               }
-       }
-       
-       // clear all ONEs when there is at least one corresponding color_T
-       // in this representation, retain one ONE otherwise
-       for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
-               if (Tvecs[rl].size()!=0) {
-                       ONEvecs[rl].clear();
-               } else if (ONEvecs[rl].size()!=0) {
-                       ONEvecs[rl].clear();
-                       ONEvecs[rl].push_back(color(color_ONE,rl));
-               }
-       }
-
-       // return a sorted vector
-       return simplified_ncmul(recombine_color_string(delta8vec,fvec,dvec,Tvecs,
-                                                                                                  ONEvecs,unknownvec));
-}
-
-ex color::thisexprseq(const exvector & v) const
-{
-       return color(type,v,representation_label);
-}
-
-ex color::thisexprseq(exvector * vp) const
-{
-       return color(type,vp,representation_label);
-}
-
-/** Check whether all indices are of class coloridx or a subclass. This
- *  function is used internally to make sure that all constructed color
- *  objects really carry color indices and not some other classes. */
-bool color::all_of_type_coloridx(void) const
-{
-       for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
-               if (!is_ex_of_type(*cit,coloridx)) return false;
-       }
-       return true;
-}
-
-//////////
-// friend functions
-//////////
-
-/** Construct an object representing the unity element of su(3).
- *
- *  @param rl Representation label
- *  @return newly constructed object */
-color color_ONE(unsigned rl)
-{
-       return color(color::color_ONE,rl);
-}
-
-/** Construct an object representing the generators T_a of SU(3). The index
- *  must be of class coloridx.
- *
- *  @param a Index
- *  @param rl Representation label
- *  @return newly constructed object */
-color color_T(const ex & a, unsigned rl)
-{
-       return color(color::color_T,a,rl);
-}
-
-/** Construct an object representing the antisymmetric structure constants
- *  f_abc of SU(3). The indices must be of class coloridx.
- *
- *  @param a First index
- *  @param b Second index
- *  @param c Third index
- *  @return newly constructed object */
-color color_f(const ex & a, const ex & b, const ex & c)
-{
-       return color(color::color_f,a,b,c);
-}
-
-/** Construct an object representing the symmetric structure constants d_abc
- *  of SU(3). The indices must be of class coloridx.
- *
- *  @param a First index
- *  @param b Second index
- *  @param c Third index
- *  @return newly constructed object */
-color color_d(const ex & a, const ex & b, const ex & c)
-{
-       return color(color::color_d,a,b,c);
-}
-
-/** This returns the linear combination d_abc+I*f_abc.
- *
- *  @param a First index
- *  @param b Second index
- *  @param c Third index
- *  @return newly constructed object */
-ex color_h(const ex & a, const ex & b, const ex & c)
-{
-       return color(color::color_d,a,b,c)+I*color(color::color_f,a,b,c);
-}
-
-/** Construct an object representing the unity matrix delta8_ab in su(3).
- *  The indices must be of class coloridx.
- *
- *  @param a First index
- *  @param b Second index
- *  @return newly constructed object */
-color color_delta8(const ex & a, const ex & b)
-{
-       return color(color::color_delta8,a,b);
-}
-
-/** Given a vector of color (and possible other) objects, split it up
- *  according to the object type (structure constant, generator etc.) and
- *  representation label while preserving the order within each group. If
- *  there are non-color objetcs in the vector, the SU(3) generators T_a get
- *  sorted into the "unknown" group together with the non-color objects
- *  because we don't know whether these objects commute with the generators.
- *
- *  @param v Source vector of expressions
- *  @param delta8vec Vector of unity matrices (returned)
- *  @param fvec Vector of antisymmetric structure constants (returned)
- *  @param dvec Vector of symmetric structure constants (returned)
- *  @param Tvecs Vectors of generators, one for each representation label (returned)
- *  @param ONEvecs Vectors of unity elements, one for each representation label (returned)
- *  @param unknownvec Vector of all non-color objects (returned)
- *
- *  @see color::color_types
- *  @see recombine_color_string */
-void split_color_string_in_parts(const exvector & v, exvector & delta8vec,
-                                 exvector & fvec, exvector & dvec,
-                                 exvectorvector & Tvecs,
-                                 exvectorvector & ONEvecs,
-                                 exvector & unknownvec)
-{
-       // if not all elements are of type color, put all Ts in unknownvec to
-       // retain the ordering
-       bool all_color=true;
-       for (exvector::const_iterator cit=v.begin(); cit!=v.end(); ++cit) {
-               if (!is_ex_exactly_of_type(*cit,color)) {
-                       all_color=false;
-                       break;
-               }
-       }
-       
-       for (exvector::const_iterator cit=v.begin(); cit!=v.end(); ++cit) {
-               if (is_ex_exactly_of_type(*cit,color)) {
-                       switch (ex_to_color(*cit).type) {
-                       case color::color_delta8:
-                               delta8vec.push_back(*cit);
-                               break;
-                       case color::color_f:
-                               fvec.push_back(*cit);
-                               break;
-                       case color::color_d:
-                               dvec.push_back(*cit);
-                               break;
-                       case color::color_T:
-                               GINAC_ASSERT(ex_to_color(*cit).representation_label<MAX_REPRESENTATION_LABELS);
-                               if (all_color) {
-                                       Tvecs[ex_to_color(*cit).representation_label].push_back(*cit);
-                               } else {
-                                       unknownvec.push_back(*cit);
-                               }
-                               break;
-                       case color::color_ONE:
-                               GINAC_ASSERT(ex_to_color(*cit).representation_label<MAX_REPRESENTATION_LABELS);
-                               ONEvecs[ex_to_color(*cit).representation_label].push_back(*cit);
-                               break;
-                       default:
-                               throw(std::logic_error("invalid type in split_color_string_in_parts()"));
-                       }
-               } else {
-                       unknownvec.push_back(*cit);
-               }
-       }
-}    
-
-/** Merge vectors of color objects sorted by object type into one vector,
- *  retaining the order within each group. This is the inverse operation of
- *  split_color_string_in_parts().
- *
- *  @param delta8vec Vector of unity matrices
- *  @param fvec Vector of antisymmetric structure constants
- *  @param dvec Vector of symmetric structure constants
- *  @param Tvecs Vectors of generators, one for each representation label
- *  @param ONEvecs Vectors of unity elements, one for each representation label
- *  @param unknownvec Vector of all non-color objects
- *  @return merged vector
- *
- *  @see color::color_types
- *  @see split_color_string_in_parts */
-exvector recombine_color_string(exvector & delta8vec, exvector & fvec,
-                                exvector & dvec, exvectorvector & Tvecs,
-                                exvectorvector & ONEvecs, exvector & unknownvec)
-{
-       unsigned sz=delta8vec.size()+fvec.size()+dvec.size()+unknownvec.size();
-       for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
-               sz += Tvecs[rl].size();
-               sz += ONEvecs[rl].size();
-       }
-       exvector v;
-       v.reserve(sz);
-       
-       append_exvector_to_exvector(v,delta8vec);
-       append_exvector_to_exvector(v,fvec);
-       append_exvector_to_exvector(v,dvec);
-       for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
-               append_exvector_to_exvector(v,Tvecs[rl]);
-               append_exvector_to_exvector(v,ONEvecs[rl]);
-       }
-       append_exvector_to_exvector(v,unknownvec);
-       return v;
-}
-
-ex color_trace_of_one_representation_label(const exvector & v)
-{
-       if (v.size()==0) {
-               return numeric(COLOR_THREE);
-       } else if (v.size()==1) {
-               GINAC_ASSERT(is_ex_exactly_of_type(*(v.begin()),color));
-               return _ex0();
-       }
-       exvector v1=v;
-       ex last_element=v1.back();
-       GINAC_ASSERT(is_ex_exactly_of_type(last_element,color));
-       GINAC_ASSERT(ex_to_color(last_element).type==color::color_T);
-       v1.pop_back();
-       ex next_to_last_element=v1.back();
-       GINAC_ASSERT(is_ex_exactly_of_type(next_to_last_element,color));
-       GINAC_ASSERT(ex_to_color(next_to_last_element).type==color::color_T);
-       v1.pop_back();
-       exvector v2=v1;
-
-       const ex & last_index=ex_to_color(last_element).seq[0];
-       const ex & next_to_last_index=ex_to_color(next_to_last_element).seq[0];
-       ex summation_index=coloridx();
-
-       v2.push_back(color_T(summation_index)); // don't care about the representation_label
-       
-       // FIXME: check this formula for SU(N) with N!=3
-       return numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
-              % color_trace_of_one_representation_label(v1)
-              +numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
-              % color_trace_of_one_representation_label(v2);
-       /*
-       ex term1=numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
-                  % color_trace_of_one_representation_label(v1);
-       cout << "term 1 of trace of " << v.size() << " ts=" << term1 << endl;
-       ex term2=numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
-                  % color_trace_of_one_representation_label(v2);
-       cout << "term 2 of trace of " << v.size() << " ts=" << term2 << endl;
-       return term1+term2;
-       */
-}
-
-/** Calculate the trace over the (hidden) indices of the su(3) Lie algebra
- *  elements (the SU(3) generators and the unity element) of a specified
- *  representation label in a string of color objects.
- *
- *  @param v Vector of color objects
- *  @param rl Representation label
- *  @return value of the trace */
-ex color_trace(const exvector & v, unsigned rl)
-{
-       GINAC_ASSERT(rl<MAX_REPRESENTATION_LABELS);
-       
-       exvector v_rest;
-       v_rest.reserve(v.size()+1); // max size if trace is empty
-       
-       exvector delta8vec;
-       exvector fvec;
-       exvector dvec;
-       exvectorvector Tvecs;
-       Tvecs.resize(MAX_REPRESENTATION_LABELS);
-       exvectorvector ONEvecs;
-       ONEvecs.resize(MAX_REPRESENTATION_LABELS);
-       exvector unknownvec;
-
-       split_color_string_in_parts(v,delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec);
-
-       if (unknownvec.size()!=0) {
-               throw(std::invalid_argument("color_trace(): expression must be expanded"));
-       }
-
-       append_exvector_to_exvector(v_rest,delta8vec);
-       append_exvector_to_exvector(v_rest,fvec);
-       append_exvector_to_exvector(v_rest,dvec);
-       for (unsigned i=0; i<MAX_REPRESENTATION_LABELS; ++i) {
-               if (i!=rl) {
-                       append_exvector_to_exvector(v_rest,Tvecs[i]);
-                       append_exvector_to_exvector(v_rest,ONEvecs[i]);
-               } else {
-                       if (Tvecs[i].size()!=0) {
-                               v_rest.push_back(color_trace_of_one_representation_label(Tvecs[i]));
-                       } else if (ONEvecs[i].size()!=0) {
-                               v_rest.push_back(numeric(COLOR_THREE));
-                       } else {
-                               throw(std::logic_error("color_trace(): representation_label not in color string"));
-                       }
-               }
-       }
-
-       return nonsimplified_ncmul(v_rest);
-}
-
-ex simplify_pure_color_string(const ex & e)
-{
-       GINAC_ASSERT(is_ex_exactly_of_type(e,ncmul));
-
-       exvector delta8vec;
-       exvector fvec;
-       exvector dvec;
-       exvectorvector Tvecs;
-       Tvecs.resize(MAX_REPRESENTATION_LABELS);
-       exvectorvector ONEvecs;
-       ONEvecs.resize(MAX_REPRESENTATION_LABELS);
-       exvector unknownvec;
-
-       split_color_string_in_parts(ex_to_ncmul(e).get_factors(),delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec);
-
-       // search for T_k S T_k (=1/2 Tr(S) - 1/6 S)
-       for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
-               if (Tvecs[rl].size()>=2) {
-                       for (unsigned i=0; i<Tvecs[rl].size()-1; ++i) {
-                               for (unsigned j=i+1; j<Tvecs[rl].size(); ++j) {
-                                       ex & t1=Tvecs[rl][i];
-                                       ex & t2=Tvecs[rl][j];
-                                       GINAC_ASSERT(is_ex_exactly_of_type(t1,color)&&
-                                                  (ex_to_color(t1).type==color::color_T)&&
-                                                  (ex_to_color(t1).seq.size()==1));
-                                       GINAC_ASSERT(is_ex_exactly_of_type(t2,color)&&
-                                                  (ex_to_color(t2).type==color::color_T)&&
-                                                  (ex_to_color(t2).seq.size()==1));
-                                       const coloridx & idx1=ex_to_coloridx(ex_to_color(t1).seq[0]);
-                                       const coloridx & idx2=ex_to_coloridx(ex_to_color(t2).seq[0]);
-                                       
-                                       if (idx1.is_equal(idx2) && idx1.is_symbolic()) {
-                                               exvector S;
-                                               for (unsigned k=i+1; k<j; ++k) {
-                                                       S.push_back(Tvecs[rl][k]);
-                                               }
-                                               t1=_ex1();
-                                               t2=_ex1();
-                                               ex term1=numeric(-1)/numeric(6)*nonsimplified_ncmul(recombine_color_string(delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
-                                               for (unsigned k=i+1; k<j; ++k) {
-                                                       S.push_back(_ex1());
-                                               }
-                                               t1=color_trace_of_one_representation_label(S);
-                                               ex term2=numeric(1)/numeric(2)*nonsimplified_ncmul(recombine_color_string(delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
-                                               return simplify_color(term1+term2);
-                                       }
-                               }
-                       }
-               }
-       }
-       
-       // FIXME: higher contractions
-       
-       return e;
-}
-       
-/** Perform some simplifications on an expression containing color objects. */
-ex simplify_color(const ex & e)
-{
-       // all simplification is done on expanded objects
-       ex e_expanded=e.expand();
-
-       // simplification of sum=sum of simplifications
-       if (is_ex_exactly_of_type(e_expanded,add)) {
-               ex sum=_ex0();
-               for (unsigned i=0; i<e_expanded.nops(); ++i)
-                       sum += simplify_color(e_expanded.op(i));
-               
-               return sum;
-       }
-
-       // simplification of commutative product=commutative product of simplifications
-       if (is_ex_exactly_of_type(e_expanded,mul)) {
-               ex prod=_ex1();
-               for (unsigned i=0; i<e_expanded.nops(); ++i)
-                       prod *= simplify_color(e_expanded.op(i));
-               
-               return prod;
-       }
-
-       // simplification of noncommutative product: test if everything is color
-       if (is_ex_exactly_of_type(e_expanded,ncmul)) {
-               bool all_color=true;
-               for (unsigned i=0; i<e_expanded.nops(); ++i) {
-                       if (!is_ex_exactly_of_type(e_expanded.op(i),color)) {
-                               all_color=false;
-                               break;
-                       }
-               }
-               if (all_color) {
-                       return simplify_pure_color_string(e_expanded);
-               }
-       }
-
-       // cannot do anything
-       return e_expanded;
-}
-
-ex brute_force_sum_color_indices(const ex & e)
-{
-       exvector iv_all=e.get_indices();
-       exvector iv_double;
-       
-       // find double symbolic indices
-       if (iv_all.size()<2) return e;
-       for (exvector::const_iterator cit1=iv_all.begin(); cit1!=iv_all.end()-1; ++cit1) {
-               GINAC_ASSERT(is_ex_of_type(*cit1,coloridx));
-               for (exvector::const_iterator cit2=cit1+1; cit2!=iv_all.end(); ++cit2) {
-                       GINAC_ASSERT(is_ex_of_type(*cit2,coloridx));
-                       if (ex_to_coloridx(*cit1).is_symbolic() && 
-                               ex_to_coloridx(*cit1).is_equal(ex_to_coloridx(*cit2))) {
-                               iv_double.push_back(*cit1);
-                               break;
-                       }
-               }
-       }
-
-       std::vector<int> counter;
-       counter.resize(iv_double.size());
-       int l;
-       for (l=0; unsigned(l)<iv_double.size(); ++l) {
-               counter[l]=1;
-       }
-
-       ex sum;
-       
-       while (1) {
-               ex term = e;
-               for (l=0; unsigned(l)<iv_double.size(); ++l) {
-                       term=term.subs(iv_double[l]==coloridx((unsigned)(counter[l])));
-                       //iv_double[l].print(cout);
-                       //cout << " " << counter[l] << " ";
-               }
-               //cout << endl;
-               sum += term;
-               
-               // increment counter[]
-               l = iv_double.size()-1;
-               while ((l>=0)&&((++counter[l])>(int)COLOR_EIGHT)) {
-                       counter[l]=1;    
-                       l--;
-               }
-               if (l<2) { std::cout << counter[0] << counter[1] << std::endl; }
-               if (l<0) break;
-       }
-       
-       return sum;
-}
-
-} // namespace GiNaC
diff --git a/ginac/color.h b/ginac/color.h
deleted file mode 100644 (file)
index 4d4169a..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/** @file color.h
- *
- *  Interface to GiNaC's color objects. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __GINAC_COLOR_H__
-#define __GINAC_COLOR_H__
-
-#include <string>
-#include <vector>
-#include "indexed.h"
-#include "ex.h"
-
-namespace GiNaC {
-
-const unsigned MAX_REPRESENTATION_LABELS = 4;
-const unsigned COLOR_EIGHT = 8; // N*N-1
-const unsigned COLOR_THREE = 3; // N
-
-// Cint doesn't like vector<..,default_alloc> but malloc_alloc is
-// unstandardized and not supported by newer GCCs.
-#if defined(__GNUC__) && ((__GNUC__ == 2) && (__GNUC_MINOR__ < 97))
-typedef std::vector<exvector,malloc_alloc> exvectorvector;
-#else
-typedef std::vector<exvector> exvectorvector;
-#endif
-
-
-/** This class holds an object carrying color indices (of class coloridx). 
- *  It can represent the generators T_a and structure constants f_abc/d_abc
- *  of SU(3), the unity element ONE of the Lie algebra of SU(3), or the
- *  unity matrix delta8. Together, these objects are used to implement the
- *  Lie algebra su(3), as required for calculations in quantum
- *  chromodynamics. A representation label (an unsigned integer) is used to
- *  distinguish elements from different Lie algebras (only objects with the
- *  same representation label "interact" with each other). */
-class color : public indexed
-{
-       GINAC_DECLARE_REGISTERED_CLASS(color, indexed)
-
-// friends
-
-       friend color color_ONE(unsigned rl);
-       friend color color_T(const ex & a, unsigned rl);
-       friend color color_f(const ex & a, const ex & b, const ex & c);
-       friend color color_d(const ex & a, const ex & b, const ex & c);
-       friend ex color_h(const ex & a, const ex & b, const ex & c);
-       friend color color_delta8(const ex & a, const ex & b);
-       friend unsigned subs_index_in_exvector(exvector & v, const ex & is, const ex & ir);
-       friend void split_color_string_in_parts(const exvector & v, exvector & delta8vec,
-                                               exvector & fvec, exvector & dvec,
-                                               exvectorvector & Tvecs,
-                                               exvectorvector & ONEvecs,
-                                               exvector & unknownvec);
-       friend exvector recombine_color_string(exvector & delta8vec, exvector & fvec,
-                                              exvector & dvec, exvectorvector & Tvecs,
-                                              exvectorvector & ONEvecs, exvector & unknownvec);
-       friend ex color_trace_of_one_representation_label(const exvector & v);
-       friend ex color_trace(const exvector & v, unsigned rl);
-       friend ex simplify_pure_color_string(const ex & e);
-       friend ex simplify_color(const ex & e);
-
-// types
-
-public:
-       /** Type of object */
-       typedef enum {
-               invalid,      /**< not properly constructed */
-               color_T,      /**< one of the generators T_a of SU(3) (these are non-commutative) */
-               color_f,      /**< one of the antisymmetric structure constants f_abc of SU(3) */
-               color_d,      /**< one of the symmetric structure constants d_abc of SU(3) */
-               color_delta8, /**< the unity matrix */
-               color_ONE     /**< the unity element of su(3) */
-       } color_types;
-       
-// member functions
-
-       // other constructors
-protected:
-       color(color_types const t, unsigned rl=0);
-       color(color_types const t, const ex & i1, unsigned rl=0);
-       color(color_types const t, const ex & i1, const ex & i2, unsigned rl=0);
-       color(color_types const t, const ex & i1, const ex & i2, const ex & i3,
-             unsigned rl=0);
-       color(color_types const t, const exvector & iv, unsigned rl=0);
-       color(color_types const t, exvector * ivp, unsigned rl=0);
-       
-       // functions overriding virtual functions from base classes
-public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
-       bool info(unsigned inf) const;
-       ex eval(int level=0) const;
-protected:
-       bool is_equal_same_type(const basic & other) const;
-       ex simplify_ncmul(const exvector & v) const;
-       ex thisexprseq(const exvector & v) const;
-       ex thisexprseq(exvector * vp) const;
-
-       // new virtual functions which can be overridden by derived classes
-       // none
-       
-       // non-virtual functions in this class
-protected:
-       bool all_of_type_coloridx(void) const;
-       
-// member variables
-
-protected:
-       color_types type; /**< Type of object (generator, structure constant etc.) */
-       unsigned representation_label; /**< Representation label to distiguish independent color matrices coming from separated fermion lines */
-};
-
-// global functions
-inline const color &ex_to_color(const ex &e)
-{
-       return static_cast<const color &>(*e.bp);
-}
-
-inline color &ex_to_nonconst_color(const ex &e)
-{
-       return static_cast<color &>(*e.bp);
-}
-
-color color_ONE(unsigned rl=0);
-color color_T(const ex & a, unsigned rl=0);
-color color_f(const ex & a, const ex & b, const ex & c);
-color color_d(const ex & a, const ex & b, const ex & c);
-ex color_h(const ex & a, const ex & b, const ex & c);
-color color_delta8(const ex & a, const ex & b);
-void split_color_string_in_parts(const exvector & v, exvector & delta8vec,
-                                 exvector & fvec, exvector & dvec,
-                                 exvectorvector & Tvecs,
-                                 exvectorvector & ONEvecs,
-                                 exvector & unknownvec);
-exvector recombine_color_string(exvector & delta8vec, exvector & fvec,
-                                exvector & dvec, exvectorvector & Tvecs,
-                                exvectorvector & ONEvecs, exvector & unknownvec);
-ex color_trace_of_one_representation_label(const exvector & v);
-ex color_trace(const exvector & v, unsigned rl=0);
-ex simplify_pure_color_string(const ex & e);
-ex simplify_color(const ex & e);
-
-ex brute_force_sum_color_indices(const ex & e);
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_COLOR_H__
diff --git a/ginac/coloridx.cpp b/ginac/coloridx.cpp
deleted file mode 100644 (file)
index cb8b629..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/** @file coloridx.cpp
- *
- *  Implementation of GiNaC's color indices. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <stdexcept>
-
-#include "coloridx.h"
-#include "archive.h"
-#include "utils.h"
-#include "debugmsg.h"
-
-namespace GiNaC {
-
-GINAC_IMPLEMENT_REGISTERED_CLASS(coloridx, idx)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-coloridx::coloridx()
-{
-       debugmsg("coloridx default constructor",LOGLEVEL_CONSTRUCT);
-       // serial is incremented in idx::idx()
-       name="color"+ToString(serial);
-       tinfo_key=TINFO_coloridx;
-}
-
-// protected
-
-void coloridx::copy(const coloridx & other)
-{
-       inherited::copy(other);
-}
-
-void coloridx::destroy(bool call_parent)
-{
-       if (call_parent) inherited::destroy(call_parent);
-}
-
-//////////
-// other constructors
-//////////
-
-// public
-
-/** Construct symbolic color index, using an automatically generated unique name.
- *
- *  @param cov Index is covariant (contravariant otherwise)
- *  @return newly constructed index */
-coloridx::coloridx(bool cov) : idx(cov)
-{
-       debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT);
-       // serial is incremented in idx::idx(bool)
-       name="color"+ToString(serial);
-       tinfo_key=TINFO_coloridx;
-}
-
-/** Construct symbolic color index with specified name.
- *
- *  @param n Symbolic index name
- *  @param cov Index is covariant (contravariant otherwise)
- *  @return newly constructed index */
-coloridx::coloridx(const std::string & n, bool cov) : idx(n,cov)
-{
-       debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_coloridx;
-}
-
-/** Construct symbolic color index with specified name.
- *
- *  @param n Symbolic index name
- *  @param cov Index is covariant (contravariant otherwise)
- *  @return newly constructed index */
-coloridx::coloridx(const char * n, bool cov) : idx(n,cov)
-{
-       debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_coloridx;
-}
-
-/** Construct numeric color index with specified value.
- *
- *  @param v Numeric index value
- *  @param cov Index is covariant (contravariant otherwise)
- *  @return newly constructed index */
-coloridx::coloridx(unsigned v, bool cov) : idx(v,cov)
-{
-       debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_coloridx;
-}
-
-//////////
-// archiving
-//////////
-
-/** Construct object from archive_node. */
-coloridx::coloridx(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
-       debugmsg("coloridx constructor from archive_node", LOGLEVEL_CONSTRUCT);
-}
-
-/** Unarchive the object. */
-ex coloridx::unarchive(const archive_node &n, const lst &sym_lst)
-{
-       return (new coloridx(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void coloridx::archive(archive_node &n) const
-{
-       inherited::archive(n);
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-void coloridx::printraw(std::ostream & os) const
-{
-       debugmsg("coloridx printraw",LOGLEVEL_PRINT);
-
-       os << "coloridx(";
-
-       if (symbolic) {
-               os << "symbolic,name=" << name;
-       } else {
-               os << "non symbolic,value=" << value;
-       }
-
-       if (covariant) {
-               os << ",covariant";
-       } else {
-               os << ",contravariant";
-       }
-
-       os << ",serial=" << serial;
-       os << ",hash=" << hashvalue << ",flags=" << flags;
-       os << ")";
-}
-
-void coloridx::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("coloridx printtree",LOGLEVEL_PRINT);
-
-       os << std::string(indent,' ') << "coloridx: ";
-
-       if (symbolic) {
-               os << "symbolic,name=" << name;
-       } else {
-               os << "non symbolic,value=" << value;
-       }
-
-       if (covariant) {
-               os << ",covariant";
-       } else {
-               os << ",contravariant";
-       }
-
-       os << ", serial=" << serial
-          << ", hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void coloridx::print(std::ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("coloridx print",LOGLEVEL_PRINT);
-
-       if (covariant) {
-               os << "_";
-       } else {
-               os << "~";
-       }
-       if (symbolic) {
-               os << name;
-       } else {
-               os << value;
-       }
-}
-
-bool coloridx::info(unsigned inf) const
-{
-       if (inf==info_flags::coloridx) return true;
-       return idx::info(inf);
-}
-
-int coloridx::compare_same_type(const basic & other) const
-{
-       return inherited::compare_same_type(other);
-}
-
-} // namespace GiNaC
diff --git a/ginac/coloridx.h b/ginac/coloridx.h
deleted file mode 100644 (file)
index ab78abb..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file coloridx.h
- *
- *  Interface to GiNaC's color indices. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __GINAC_COLORIDX_H__
-#define __GINAC_COLORIDX_H__
-
-#include <string>
-#include <vector>
-#include "idx.h"
-#include "ex.h"
-
-namespace GiNaC {
-
-
-/** Class of indices for color algebra objects, to tell them apart from
- *  other index families like Lorentz indices. The color indices are the
- *  indices of the SU(3) generators T_a, so they lie in the range of 0 to 7. 
- *  Note that this kind of index is different from the indices carried by
- *  elements of a specific matrix representation of su(3). Such indices are
- *  always hidden in our implementation and we are not concerned with them. */
-class coloridx : public idx
-{
-       GINAC_DECLARE_REGISTERED_CLASS(coloridx, idx)
-
-       friend class color;
-
-       // other constructors
-public:
-       explicit coloridx(bool cov);
-       explicit coloridx(const std::string & n, bool cov=false);
-       explicit coloridx(const char * n, bool cov=false);
-       explicit coloridx(unsigned v, bool cov=false); 
-
-       // functions overriding virtual functions from bases classes
-public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
-       bool info(unsigned inf) const;
-
-       // new virtual functions which can be overridden by derived classes
-       // none
-
-       // non-virtual functions in this class
-       // none
-
-       // member variables
-       // none
-};
-
-// utility functions
-inline const coloridx &ex_to_coloridx(const ex &e)
-{
-       return static_cast<const coloridx &>(*e.bp);
-}
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_COLORIDX_H__
diff --git a/ginac/isospin.cpp b/ginac/isospin.cpp
deleted file mode 100644 (file)
index 2a2a254..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/** @file isospin.cpp
- *
- *  Implementation of GiNaC's isospin objects.
- *  No real implementation yet, to be done.     */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string>
-
-#include "isospin.h"
-#include "ex.h"
-#include "ncmul.h"
-#include "lst.h"
-#include "archive.h"
-#include "utils.h"
-#include "debugmsg.h"
-
-namespace GiNaC {
-
-GINAC_IMPLEMENT_REGISTERED_CLASS(isospin, indexed)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-isospin::isospin()
-{
-       debugmsg("isospin default constructor",LOGLEVEL_CONSTRUCT);
-       serial=next_serial++;
-       name=autoname_prefix()+ToString(serial);
-       tinfo_key=TINFO_isospin;
-}
-
-// protected
-
-void isospin::copy(const isospin & other)
-{
-       inherited::copy(other);
-       name=other.name;
-       serial=other.serial;
-}
-
-void isospin::destroy(bool call_parent)
-{
-       if (call_parent) {
-               inherited::destroy(call_parent);
-       }
-}
-
-//////////
-// other constructors
-//////////
-
-// public
-
-isospin::isospin(const std::string & initname)
-{
-       debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT);
-       name=initname;
-       serial=next_serial++;
-       tinfo_key=TINFO_isospin;
-}
-
-//////////
-// archiving
-//////////
-
-/** Construct object from archive_node. */
-isospin::isospin(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
-       debugmsg("isospin constructor from archive_node", LOGLEVEL_CONSTRUCT);
-       serial = next_serial++;
-       if (!(n.find_string("name", name)))
-               name = autoname_prefix() + ToString(serial);
-       tinfo_key = TINFO_isospin;
-}
-
-/** Unarchive the object. */
-ex isospin::unarchive(const archive_node &n, const lst &sym_lst)
-{
-       ex s = (new isospin(n, sym_lst))->setflag(status_flags::dynallocated);
-
-       // If isospin is in sym_lst, return the existing isospin
-       for (unsigned i=0; i<sym_lst.nops(); i++) {
-               if (is_ex_of_type(sym_lst.op(i), isospin) && (ex_to_isospin(sym_lst.op(i)).name == ex_to_isospin(s).name))
-                       return sym_lst.op(i);
-       }
-       return s;
-}
-
-/** Archive the object. */
-void isospin::archive(archive_node &n) const
-{
-       inherited::archive(n);
-       n.add_string("name", name);
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-void isospin::printraw(std::ostream & os) const
-{
-       debugmsg("isospin printraw",LOGLEVEL_PRINT);
-       os << "isospin(" << "name=" << name << ",serial=" << serial
-          << ",indices=";
-       printrawindices(os);
-       os << ",hash=" << hashvalue << ",flags=" << flags << ")";
-}
-
-void isospin::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("isospin printtree",LOGLEVEL_PRINT);
-       os << std::string(indent,' ') << name << " (isospin): "
-          << "serial=" << serial << ","
-          << seq.size() << "indices=";
-       printtreeindices(os,indent);
-       os << ", hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void isospin::print(std::ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("isospin print",LOGLEVEL_PRINT);
-       os << name;
-       printindices(os);
-}
-
-void isospin::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
-{
-       debugmsg("isospin print csrc",LOGLEVEL_PRINT);
-       print(os,upper_precedence);
-}
-
-bool isospin::info(unsigned inf) const
-{
-       return inherited::info(inf);
-}
-
-// protected
-
-int isospin::compare_same_type(const basic & other) const
-{
-       GINAC_ASSERT(other.tinfo() == TINFO_isospin);
-       const isospin *o = static_cast<const isospin *>(&other);
-       if (serial==o->serial) {
-               return inherited::compare_same_type(other);
-       }
-       return serial < o->serial ? -1 : 1;
-}
-
-ex isospin::simplify_ncmul(const exvector & v) const
-{
-       return simplified_ncmul(v);
-}
-
-unsigned isospin::calchash(void) const
-{
-       hashvalue = golden_ratio_hash(golden_ratio_hash(0x55555556U ^
-                   golden_ratio_hash(tinfo_key) ^ serial));
-       setflag(status_flags::hash_calculated);
-       return hashvalue;
-}
-
-//////////
-// virtual functions which can be overridden by derived classes
-//////////
-
-// none
-
-//////////
-// non-virtual functions in this class
-//////////
-
-void isospin::setname(const std::string & n)
-{
-       name = n;
-}
-
-// private
-
-std::string & isospin::autoname_prefix(void)
-{
-       static std::string * s = new std::string("isospin");
-       return *s;
-}
-
-//////////
-// static member variables
-//////////
-
-// private
-
-unsigned isospin::next_serial = 0;
-
-} // namespace GiNaC
-
diff --git a/ginac/isospin.h b/ginac/isospin.h
deleted file mode 100644 (file)
index 925ef63..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file isospin.h
- *
- *  Interface to GiNaC's isospin objects. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __GINAC_ISOSPIN_H__
-#define __GINAC_ISOSPIN_H__
-
-#include <string>
-#include "indexed.h"
-
-namespace GiNaC {
-
-/** Base class for isospin object */
-class isospin : public indexed
-{
-       GINAC_DECLARE_REGISTERED_CLASS(isospin, indexed)
-
-       // other constructors
-public:
-       explicit isospin(const std::string & initname);
-
-       // functions overriding virtual functions from base classes
-public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
-       void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
-       bool info(unsigned inf) const;
-protected:
-       ex simplify_ncmul(const exvector & v) const;
-       unsigned calchash(void) const;
-
-       // new virtual functions which can be overridden by derived classes
-       // none
-       
-       // non-virtual functions in this class
-public:
-       void setname(const std::string & n);
-private:
-       std::string & autoname_prefix(void);
-
-// member variables
-
-protected:
-       std::string name;
-       unsigned serial; // unique serial number for comparision
-private:
-       static unsigned next_serial;
-};
-
-// utility functions
-inline const isospin &ex_to_isospin(const ex &e)
-{
-       return static_cast<const isospin &>(*e.bp);
-}
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_ISOSPIN_H__
diff --git a/ginac/lorentzidx.cpp b/ginac/lorentzidx.cpp
deleted file mode 100644 (file)
index 783316c..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-/** @file lorentzidx.cpp
- *
- *  Implementation of GiNaC's Lorentz indices. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <stdexcept>
-
-#include "lorentzidx.h"
-#include "lst.h"
-#include "symbol.h"
-#include "archive.h"
-#include "utils.h"
-#include "debugmsg.h"
-
-namespace GiNaC {
-
-GINAC_IMPLEMENT_REGISTERED_CLASS(lorentzidx, idx)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-lorentzidx::lorentzidx() : orthogonal_only(false), dim_parallel_space(0)
-{
-       debugmsg("lorentzidx default constructor",LOGLEVEL_CONSTRUCT);
-       // serial is incremented in idx::idx()
-       name = "mu" + ToString(serial);
-       tinfo_key = TINFO_lorentzidx;
-}
-
-// protected
-
-void lorentzidx::copy(const lorentzidx & other)
-{
-       inherited::copy(other);
-       orthogonal_only=other.orthogonal_only;
-       dim_parallel_space=other.dim_parallel_space;
-}
-
-void lorentzidx::destroy(bool call_parent)
-{
-       if (call_parent) inherited::destroy(call_parent);
-}
-
-//////////
-// other constructors
-//////////
-
-// public
-
-/** Construct symbolic Lorentz index, using an automatically generated unique name.
- *
- *  @param cov Index is covariant (contravariant otherwise)
- *  @param oonly Index only lives in orthogonal space
- *  @param dimp Dimension of parallel space
- *  @return newly constructed index */
-lorentzidx::lorentzidx(bool cov, bool oonly, unsigned dimp)
-  : idx(cov), orthogonal_only(oonly), dim_parallel_space(dimp)
-{
-       debugmsg("lorentzidx constructor from bool,bool,unsigned",LOGLEVEL_CONSTRUCT);
-       // serial is incremented in idx::idx(bool)
-       if (oonly) {
-               name="muorth"+ToString(serial);
-       } else {
-               name="mu"+ToString(serial);
-       }
-       tinfo_key=TINFO_lorentzidx;
-}
-
-/** Construct symbolic Lorentz index with specified name.
- *
- *  @param n Symbolic index name
- *  @param cov Index is covariant (contravariant otherwise)
- *  @param oonly Index only lives in orthogonal space
- *  @param dimp Dimension of parallel space
- *  @return newly constructed index */
-lorentzidx::lorentzidx(const std::string & n, bool cov, bool oonly, unsigned dimp)
-  : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp)
-{
-       debugmsg("lorentzidx constructor from string,bool,bool,unsigned",
-                        LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_lorentzidx;
-}
-
-/** Construct symbolic Lorentz index with specified name.
- *
- *  @param n Symbolic index name
- *  @param cov Index is covariant (contravariant otherwise)
- *  @param oonly Index only lives in orthogonal space
- *  @param dimp Dimension of parallel space
- *  @return newly constructed index */
-lorentzidx::lorentzidx(const char * n, bool cov, bool oonly, unsigned dimp)
-  : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp)
-{
-       debugmsg("lorentzidx constructor from char*,bool,bool,unsigned",
-                        LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_lorentzidx;
-}
-
-/** Construct numeric Lorentz index with specified value.
- *
- *  @param v Numeric index value
- *  @param cov Index is covariant (contravariant otherwise)
- *  @return newly constructed index */
-lorentzidx::lorentzidx(unsigned v, bool cov)
-  : idx(v,cov), orthogonal_only(false), dim_parallel_space(0)
-{
-       debugmsg("lorentzidx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_lorentzidx;
-}
-
-//////////
-// archiving
-//////////
-
-/** Construct object from archive_node. */
-lorentzidx::lorentzidx(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
-       debugmsg("lorentzidx constructor from archive_node", LOGLEVEL_CONSTRUCT);
-       n.find_bool("orthogonal_only", orthogonal_only);
-       n.find_unsigned("pdim", dim_parallel_space);
-}
-
-/** Unarchive the object. */
-ex lorentzidx::unarchive(const archive_node &n, const lst &sym_lst)
-{
-       ex s = (new lorentzidx(n, sym_lst))->setflag(status_flags::dynallocated);
-
-       if (ex_to_lorentzidx(s).symbolic) {
-               // If lorentzidx is in sym_lst, return the existing lorentzidx
-               for (unsigned i=0; i<sym_lst.nops(); i++) {
-                       if (is_ex_of_type(sym_lst.op(i), lorentzidx) && (ex_to_lorentzidx(sym_lst.op(i)).name == ex_to_lorentzidx(s).name))
-                               return sym_lst.op(i);
-               }
-       }
-       return s;
-}
-
-/** Archive the object. */
-void lorentzidx::archive(archive_node &n) const
-{
-       inherited::archive(n);
-       n.add_bool("orthogonal_only", orthogonal_only);
-       n.add_unsigned("pdim", dim_parallel_space);
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-void lorentzidx::printraw(std::ostream & os) const
-{
-       debugmsg("lorentzidx printraw",LOGLEVEL_PRINT);
-
-       os << "lorentzidx(";
-
-       if (symbolic) {
-               os << "symbolic,name=" << name;
-       } else {
-               os << "non symbolic,value=" << value;
-       }
-
-       if (covariant) {
-               os << ",covariant";
-       } else {
-               os << ",contravariant";
-       }
-
-       if (orthogonal_only) {
-               os << ",only orthogonal components at " << dim_parallel_space
-                  << " parallel dimensions";
-       } else {
-               os << ",parallel and orthogonal components";
-       }
-
-       os << ",serial=" << serial;
-       os << ",hash=" << hashvalue << ",flags=" << flags;
-       os << ")";
-}
-
-void lorentzidx::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("lorentzidx printtree",LOGLEVEL_PRINT);
-
-       os << std::string(indent,' ') << "lorentzidx: ";
-
-       if (symbolic) {
-               os << "symbolic,name=" << name;
-       } else {
-               os << "non symbolic,value=" << value;
-       }
-
-       if (covariant) {
-               os << ",covariant";
-       } else {
-               os << ",contravariant";
-       }
-
-       if (orthogonal_only) {
-               os << ",only orthogonal components at " << dim_parallel_space
-                  << " parallel dimensions";
-       } else {
-               os << ",parallel and orthogonal components";
-       }
-
-       os << ", serial=" << serial
-          << ", hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void lorentzidx::print(std::ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("lorentzidx print",LOGLEVEL_PRINT);
-
-       if (covariant) {
-               os << "_";
-       } else {
-               os << "~";
-       }
-       if (symbolic) {
-               os << name;
-       } else {
-               os << value;
-       }
-}
-
-bool lorentzidx::info(unsigned inf) const
-{
-       if (inf==info_flags::lorentzidx) return true;
-       return inherited::info(inf);
-}
-
-int lorentzidx::compare_same_type(const basic & other) const
-{
-       GINAC_ASSERT(is_of_type(other, lorentzidx));
-       const lorentzidx &o = static_cast<const lorentzidx &>(other);
-
-       if (orthogonal_only != o.orthogonal_only)
-               return orthogonal_only ? -1 : 1;
-       if (dim_parallel_space != o.dim_parallel_space)
-               return dim_parallel_space < o.dim_parallel_space ? -1 : 1;
-       return inherited::compare_same_type(other);
-}
-
-//////////
-// non-virtual functions in this class
-//////////
-
-// public
-
-/** Create anonymous contravariant copy of a symbolic Lorentz index. */
-lorentzidx lorentzidx::create_anonymous_representative(void) const
-{
-       GINAC_ASSERT(is_symbolic());
-       lorentzidx i_copy(*this);
-       i_copy.serial=0;
-       i_copy.name="anonymous_representative";
-       i_copy.covariant=false;
-       i_copy.clearflag(status_flags::dynallocated |
-                        status_flags::hash_calculated);
-       return i_copy;
-}
-
-//////////
-// global functions
-//////////
-
-/** Return the global symbol that represents the dimension D of spacetime. */
-ex Dim(void)
-{
-       static symbol *d = new symbol("dim");
-       return *d;
-}
-
-} // namespace GiNaC
diff --git a/ginac/lorentzidx.h b/ginac/lorentzidx.h
deleted file mode 100644 (file)
index d4226e1..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/** @file lorentzidx.h
- *
- *  Interface to GiNaC's Lorentz indices. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __GINAC_LORENTZIDX_H__
-#define __GINAC_LORENTZIDX_H__
-
-#include <string>
-#include <vector>
-#include "idx.h"
-
-namespace GiNaC {
-
-
-/** Class of indices for Lorentz tensors, to tell them apart from other
- *  index families like color indices. The indices of this class also
- *  support the case of P-O-decomposed D-dimensional spacetime, where the
- *  parallel space is a Minkowski space with integral dimension P and the
- *  orthogonal space is a Euclidean space with (possibly complex) dimension
- *  D-P. The dimension D of spacetime is represented by the global symbol
- *  that is returned by the Dim() function. */
-class lorentzidx : public idx
-{
-       GINAC_DECLARE_REGISTERED_CLASS(lorentzidx, idx)
-
-       friend class simp_lor;
-       friend class scalar_products;
-
-// member functions
-
-       // other constructors
-public:
-       explicit lorentzidx(bool cov, bool oonly=false, unsigned dimp=0);
-       explicit lorentzidx(const std::string & n, bool cov=false,
-                           bool oonly=false, unsigned dimp=0);
-       explicit lorentzidx(const char * n, bool cov=false,
-                           bool oonly=false, unsigned dimp=0);
-       explicit lorentzidx(unsigned v, bool cov=false);
-
-       // functions overriding virtual functions from bases classes
-public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
-       bool info(unsigned inf) const;
-
-       // new virtual functions which can be overridden by derived classes
-       // none
-
-       // non-virtual functions in this class
-public:
-       /** Check whether index only lives in orthogonal space. */
-       bool is_orthogonal_only(void) const {return orthogonal_only;}
-
-       /** Return dimension of parallel space. */
-       unsigned get_dim_parallel_space(void) const {return dim_parallel_space;}
-
-       lorentzidx create_anonymous_representative(void) const; 
-
-       // member variables
-protected:
-       bool orthogonal_only;        /**< Symbolic index only lives in orthogonal space? */
-       unsigned dim_parallel_space; /**< Dimension of parallel space */
-};
-
-// utility functions
-inline const lorentzidx &ex_to_lorentzidx(const ex &e)
-{
-       return static_cast<const lorentzidx &>(*e.bp);
-}
-
-ex Dim(void);
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_LORENTZIDX_H__
diff --git a/ginac/lortensor.cpp b/ginac/lortensor.cpp
deleted file mode 100644 (file)
index 1dae91a..0000000
+++ /dev/null
@@ -1,575 +0,0 @@
-/** @file lortensor.cpp
- *
- *  Implementation of GiNaC's Lorentz tensors. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string>
-#include <list>
-#include <algorithm>
-#include <iostream>
-#include <stdexcept>
-#include <map>
-
-#include "basic.h"
-#include "add.h"
-#include "mul.h"
-#include "debugmsg.h"
-#include "lst.h"
-#include "lortensor.h"
-#include "operators.h"
-#include "tinfos.h"
-#include "power.h"
-#include "archive.h"
-#include "utils.h"
-#include "config.h"
-
-namespace GiNaC {
-
-GINAC_IMPLEMENT_REGISTERED_CLASS(lortensor, indexed)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-lortensor::lortensor() : inherited(TINFO_lortensor), type(invalid)
-{
-       debugmsg("lortensor default constructor",LOGLEVEL_CONSTRUCT);
-       serial=next_serial++;
-       name=autoname_prefix()+ToString(serial);
-}
-
-//protected
-
-void lortensor::copy(const lortensor & other)
-{
-       inherited::copy(other);
-       type=other.type;
-       name=other.name;
-       serial=other.serial;
-}
-
-void lortensor::destroy(bool call_parent)
-{
-       if (call_parent) inherited::destroy(call_parent);
-}
-
-//////////
-// other constructors
-//////////
-
-// protected
-
-/** Construct object without any Lorentz index. This constructor is for
- *  internal use only. */
-lortensor::lortensor(lortensor_types const lt, const std::string & n) : type(lt), name(n)
-{
-       debugmsg("lortensor constructor from lortensor_types,string",LOGLEVEL_CONSTRUCT);
-       if (lt == lortensor_symbolic)
-               serial = next_serial++;
-       else
-               serial = 0;
-       tinfo_key = TINFO_lortensor;
-}
-
-/** Construct object with one Lorentz index. This constructor is for
- *  internal use only. Use the lortensor_vector() or lortensor_symbolic()
- *  functions instead.
- *  @see lortensor_vector
- *  @see lortensor_symbolic */
-lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu) : inherited(mu), type(lt), name(n)
-{
-       debugmsg("lortensor constructor from lortensor_types,string,ex",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       if (lt == lortensor_symbolic)
-               serial = next_serial++;
-       else
-               serial = 0;
-       tinfo_key=TINFO_lortensor;
-}
-
-/** Construct object with two Lorentz indices. This constructor is for
- *  internal use only. Use the lortensor_g(), lortensor_delta() or
- *  lortensor_symbolic() functions instead.
- *  @see lortensor_g
- *  @see lortensor_delta
- *  @see lortensor_symbolic */
-lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu) : inherited(mu,nu), type(lt), name(n)
-{
-       debugmsg("lortensor constructor from lortensor_types,string,ex,ex",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       if (lt == lortensor_symbolic)
-               serial = next_serial++;
-       else
-               serial = 0;
-       tinfo_key=TINFO_lortensor;
-}
-
-/** Construct object with three Lorentz indices. This constructor is for
- *  internal use only. Use the lortensor_symbolic() function instead.
- *  @see lortensor_symbolic */
-lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu, const ex & rho) : inherited(mu,nu,rho), type(lt), name(n)
-{
-       debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       if (lt == lortensor_symbolic)
-               serial = next_serial++;
-       else
-               serial = 0;
-       tinfo_key=TINFO_lortensor;
-}
-
-/** Construct object with four Lorentz indices. This constructor is for
- *  internal use only. Use the lortensor_epsilon() or lortensor_symbolic()
- *  functions instead.
- *  @see lortensor_epsilon
- *  @see lortensor_symbolic */
-lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma) : inherited(mu,nu,rho,sigma), type(lt), name(n)
-{
-       debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex,ex",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       if (lt == lortensor_symbolic)
-               serial = next_serial++;
-       else
-               serial = 0;
-       tinfo_key=TINFO_lortensor;
-}
-
-/** Construct object with arbitrary number of Lorentz indices. This
- *  constructor is for internal use only. Use the lortensor_symbolic()
- *  function instead.
- *
- *  @see lortensor_symbolic */
-lortensor::lortensor(lortensor_types const lt, const std::string & n, const exvector & iv) : inherited(iv), type(lt), name(n)
-{
-       debugmsg("lortensor constructor from lortensor_types,string,exvector",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       if (lt == lortensor_symbolic)
-               serial = next_serial++;
-       else
-               serial = 0;
-       tinfo_key=TINFO_lortensor;
-}
-
-lortensor::lortensor(lortensor_types const lt, const std::string & n, unsigned s, const exvector & iv) : indexed(iv), type(lt), name(n), serial(s)
-{
-       debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       tinfo_key=TINFO_lortensor;
-}
-
-lortensor::lortensor(lortensor_types const lt, const std::string & n, unsigned s, exvector *ivp) : indexed(ivp), type(lt), name(n), serial(s)
-{
-       debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT);
-       GINAC_ASSERT(all_of_type_lorentzidx());
-       tinfo_key=TINFO_lortensor;
-}
-
-
-//////////
-// archiving
-//////////
-
-/** Construct object from archive_node. */
-lortensor::lortensor(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
-       debugmsg("lortensor constructor from archive_node", LOGLEVEL_CONSTRUCT);
-       unsigned int ty;
-       if (!(n.find_unsigned("type", ty)))
-               throw (std::runtime_error("unknown lortensor type in archive"));
-       type = (lortensor_types)ty;
-       if (type == lortensor_symbolic) {
-               serial = next_serial++;
-               if (!(n.find_string("name", name)))
-                       name = autoname_prefix() + ToString(serial);
-       } else
-               serial = 0;
-}
-
-/** Unarchive the object. */
-ex lortensor::unarchive(const archive_node &n, const lst &sym_lst)
-{
-       ex s = (new lortensor(n, sym_lst))->setflag(status_flags::dynallocated);
-
-       if (ex_to_lortensor(s).type == lortensor_symbolic) {
-               // If lortensor is in sym_lst, return the existing lortensor
-               for (unsigned i=0; i<sym_lst.nops(); i++) {
-                       if (is_ex_of_type(sym_lst.op(i), lortensor) && (ex_to_lortensor(sym_lst.op(i)).name == ex_to_lortensor(s).name))
-                               return sym_lst.op(i);
-               }
-       }
-       return s;
-}
-
-/** Archive the object. */
-void lortensor::archive(archive_node &n) const
-{
-       inherited::archive(n);
-       n.add_unsigned("type", type);
-       if (type == lortensor_symbolic)
-               n.add_string("name", name);
-}
-
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-//public
-
-void lortensor::printraw(std::ostream & os) const
-{
-       debugmsg("lortensor printraw",LOGLEVEL_PRINT);
-       os << "lortensor(type=" << (unsigned)type
-          << ",indices=";
-       printrawindices(os);
-       os << ",serial=" << serial;
-       os << ",hash=" << hashvalue << ",flags=" << flags << ")";
-}
-
-void lortensor::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("lortensor printtree",LOGLEVEL_PRINT);
-       os << std::string(indent,' ') <<"lortensor object: "
-          << "type=" << (unsigned)type << ","
-          << seq.size() << " indices" << std::endl;
-       printtreeindices(os,indent);
-       os << std::string(indent,' ') << "hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void lortensor::print(std::ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("lortensor print",LOGLEVEL_PRINT);
-       switch (type) {
-       case lortensor_g:
-               os << "g";
-               break;
-       case lortensor_delta:
-               os << "delta";
-               break;
-       case lortensor_epsilon:
-               os << "epsilon";
-               break;
-       case lortensor_symbolic:
-               os << name;
-               break;
-       case invalid:
-       default:
-               os << "INVALID_LORTENSOR_OBJECT";
-               break;
-       }
-       printindices(os);
-}
-
-bool lortensor::info(unsigned inf) const
-{
-       return inherited::info(inf);
-}
-
-ex lortensor::eval(int level) const
-{
-       if (type==lortensor_g) {
-               // canonicalize indices
-               exvector iv=seq;
-               int sig=canonicalize_indices(iv,false); //symmetric
-               if (sig!=INT_MAX) {
-                       //something has changed while sorting indices, more evaluations later
-                       return ex(sig) *lortensor(type,name,iv);
-               }
-               const lorentzidx & idx1=ex_to_lorentzidx(seq[0]);
-               const lorentzidx & idx2=ex_to_lorentzidx(seq[1]);
-               if ((!idx1.is_symbolic()) && (!idx2.is_symbolic())) {
-                       //both indices are numeric
-                       if ((idx1.get_value()==idx2.get_value())) {
-                               //both on diagonal
-                               if (idx1.get_value()==0){
-                                       // (0,0)
-                                       return _ex1();
-                               } else {
-                                       if (idx1.is_covariant() != idx2.is_covariant()) {
-                                               // (_i,~i) or (~i,_i), i = 1...3
-                                               return _ex1();
-                                       } else {
-                                               // (_i,_i) or (~i,~i), i= 1...3
-                                               return _ex_1();
-                                       }
-                               }
-                       } else {
-                               // at least one off-diagonal
-                               return _ex0();
-                       }
-               } else if (idx1.is_symbolic() && idx1.is_co_contra_pair(idx2)) {
-                       if (idx1.is_orthogonal_only())
-                               return Dim() - idx1.get_dim_parallel_space();
-                       else
-                               return Dim();
-               }
-       }
-       return this -> hold();
-}
-
-//protected
-
-int lortensor::compare_same_type(const basic & other) const
-{
-       GINAC_ASSERT(is_of_type(other,lortensor));
-       const lortensor &o = static_cast<const lortensor &>(other);
-
-       if (type!=o.type) {
-               // different type
-               return type < o.type ? -1 : 1;
-       }
-
-       if (type == lortensor_symbolic) {
-               // symbolic, compare serials
-               if (serial != o.serial) {
-                       return serial < o.serial ? -1 : 1;
-               }
-       }
-
-       return inherited::compare_same_type(other);
-}
-
-bool lortensor::is_equal_same_type(const basic & other) const
-{
-       GINAC_ASSERT(is_of_type(other,lortensor));
-       const lortensor &o = static_cast<const lortensor &>(other);
-
-       if (type != o.type) return false;
-       if (type == lortensor_symbolic && serial != o.serial) return false;
-       return inherited::is_equal_same_type(other);            
-}
-
-unsigned lortensor::return_type(void) const
-{
-       return return_types::commutative;
-}
-
-unsigned lortensor::return_type_tinfo(void) const
-{
-       return tinfo_key;
-}
-
-ex lortensor::thisexprseq(const exvector & v) const
-{
-       return lortensor(type,name,serial,v);
-}
-
-ex lortensor::thisexprseq(exvector *vp) const
-{
-       return lortensor(type,name,serial,vp);
-}
-       
-//////////
-// non-virtual functions in this class
-//////////
-
-// protected
-
-/** Check whether all indices are of class lorentzidx or a subclass. This
- *  function is used internally to make sure that all constructed Lorentz
- *  tensors really carry Lorentz indices and not some other classes. */
-bool lortensor::all_of_type_lorentzidx(void) const
-{
-       for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++ cit) {
-               if (!is_ex_of_type(*cit,lorentzidx)) return false;
-       }
-       return true;
-}
-
-// private
-
-std::string & lortensor::autoname_prefix(void)
-{
-       static std::string * s = new std::string("lortensor");
-       return *s;
-}
-
-//////////
-// static member variables
-//////////
-
-// private
-
-unsigned lortensor::next_serial=0;
-
-//////////
-// friend functions
-//////////
-
-/** Construct an object representing the metric tensor g. The indices must
- *  be of class lorentzidx.
- *
- *  @param mu First index
- *  @param nu Second index
- *  @return newly constructed object */
-lortensor lortensor_g(const ex & mu, const ex & nu)
-{
-       return lortensor(lortensor::lortensor_g,"",mu,nu);
-}
-
-/** Construct an object representing the unity matrix delta. The indices
- *  must be of class lorentzidx.
- *
- *  @param mu First index
- *  @param nu Second index
- *  @return newly constructed object */
-lortensor lortensor_delta(const ex & mu, const ex & nu)
-{
-       return lortensor(lortensor::lortensor_delta,"",mu,nu);
-}
-
-/** Construct an object representing the four-dimensional totally
- *  antisymmetric tensor epsilon. The indices must be of class lorentzidx.
- *
- *  @param mu First index
- *  @param nu Second index
- *  @param rho Third index
- *  @param sigma Fourth index
- *  @return newly constructed object */
-lortensor lortensor_epsilon(const ex & mu, const ex & nu, const ex & rho, const ex & sigma)
-{
-       return lortensor(lortensor::lortensor_epsilon,"",mu,nu,rho,sigma);
-}
-
-/** Construct an object representing a symbolic Lorentz vector. The index
- *  must be of class lorentzidx.
- *
- *  @param n Symbolic name
- *  @param mu Index
- *  @return newly constructed object */
-lortensor lortensor_vector(const std::string & n, const ex & mu)
-{
-       return lortensor(lortensor::lortensor_symbolic,n,mu);
-}
-
-/** Construct an object representing a symbolic Lorentz tensor of arbitrary
- *  rank. The indices must be of class lorentzidx.
- *
- *  @param n Symbolic name
- *  @param iv Vector of indices
- *  @return newly constructed object */
-lortensor lortensor_symbolic(const std::string & n, const exvector & iv)
-{
-       return lortensor(lortensor::lortensor_symbolic,n,iv);
-}
-
-ex simplify_lortensor_mul(const ex & m)
-{
-       GINAC_ASSERT(is_ex_exactly_of_type(m,mul));
-       exvector v_contracted;
-
-       // collect factors in an exvector, store squares twice
-       int n=m.nops();
-       v_contracted.reserve(2*n);
-       for (int i=0; i<n; ++i) {
-               ex f=m.op(i);
-               if (is_ex_exactly_of_type(f,power)&&f.op(1).is_equal(_ex2())) {
-                       v_contracted.push_back(f.op(0));
-                       v_contracted.push_back(f.op(0));
-               } else {
-                       v_contracted.push_back(f);
-               }
-       }
-
-       unsigned replacements;
-       bool something_changed=false;
-
-       exvector::iterator it=v_contracted.begin();
-       while (it!=v_contracted.end()) {
-               // process only lor_g objects
-               if (is_ex_exactly_of_type(*it,lortensor) &&
-                       (ex_to_lortensor(*it).type==lortensor::lortensor_g)) {            
-                       const lortensor & g=ex_to_lortensor(*it);
-                       GINAC_ASSERT(g.seq.size()==2);
-                       const idx & first_idx=ex_to_lorentzidx(g.seq[0]);
-                       const idx & second_idx=ex_to_lorentzidx(g.seq[1]);
-                       // g_{mu,mu} should have been contracted in lortensor::eval()
-                       GINAC_ASSERT(!first_idx.is_equal(second_idx));
-                       ex saved_g=*it; // save to restore it later
-
-                       // try to contract first index
-                       replacements=0;
-                       if (first_idx.is_symbolic()) {
-                               replacements = subs_index_in_exvector(v_contracted,
-                                                                     first_idx.toggle_covariant(),second_idx);
-                               if (replacements==0) {
-                                       // not contracted, restore g object
-                                       *it=saved_g;
-                               } else {
-                                       // a contracted index should occur exactly once
-                                       GINAC_ASSERT(replacements==1);
-                                       *it=_ex1();
-                                       something_changed=true;
-                               }
-                       }
-
-                       // try second index only if first was not contracted
-                       if ((replacements==0)&&(second_idx.is_symbolic())) {
-                               // first index not contracted, *it is again the original g object
-                               replacements = subs_index_in_exvector(v_contracted,
-                                                                     second_idx.toggle_covariant(),first_idx);
-                               if (replacements==0) {
-                                       // not contracted except in itself, restore g object
-                                       *it=saved_g;
-                               } else {
-                                       // a contracted index should occur exactly once
-                                       GINAC_ASSERT(replacements==1);
-                                       *it=_ex1();
-                                       something_changed=true;
-                               }
-                       }
-               }
-               ++it;
-       }
-       if (something_changed) {
-               return mul(v_contracted);
-       }
-       return m;
-}
-
-/** Perform some simplifications on an expression containing Lorentz tensors. */
-ex simplify_lortensor(const ex & e)
-{
-       // all simplification is done on expanded objects
-       ex e_expanded = e.expand();
-
-       // simplification of sum=sum of simplifications
-       if (is_ex_exactly_of_type(e_expanded,add)) {
-               ex sum=_ex0();
-               for (unsigned i=0; i<e_expanded.nops(); ++i) {
-                       sum += simplify_lortensor(e_expanded.op(i));
-               }
-               return sum;
-       }
-
-       // simplification of (commutative) product
-       if (is_ex_exactly_of_type(e_expanded,mul)) {
-               return simplify_lortensor_mul(e);
-       }
-
-       // cannot do anything
-       return e_expanded;
-}
-
-} // namespace GiNaC
diff --git a/ginac/lortensor.h b/ginac/lortensor.h
deleted file mode 100644 (file)
index 8fbadd3..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/** @file lortensor.h
- *
- *  Interface to GiNaC's Lorentz tensors. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __GINAC_LORTENSOR_H__
-#define __GINAC_LORTENSOR_H__
-
-#include <string>
-#include <vector>
-#include <iostream>
-#include "indexed.h"
-#include "lorentzidx.h"
-
-namespace GiNaC {
-
-
-/** This class holds an object carrying Lorentz indices (of class
- *  lorentzidx). It can represent a general (symbolic) tensor of type
- *  (p,q), or one of the constant tensors g (the metric), delta (unity
- *  matrix) or epsilon (4-dimensional totally antisymmetric tensor). */
-class lortensor : public indexed
-{
-       GINAC_DECLARE_REGISTERED_CLASS(lortensor, indexed)
-
-// friends
-
-       friend lortensor lortensor_g(const ex & mu, const ex & nu);
-       friend lortensor lortensor_delta(const ex & mu, const ex & nu);
-       friend lortensor lortensor_epsilon(const ex & mu, const ex & nu,
-                                                                          const ex & rho, const ex & sigma);
-       friend lortensor lortensor_vector(const std::string & n, const ex & mu);
-       friend lortensor lortensor_symbolic(const std::string & name, const exvector & iv);
-
-       friend ex simplify_lortensor_mul(const ex & m);
-       friend ex simplify_lortensor(const ex & e);
-       
-// types
-
-public:
-       typedef enum {
-               invalid,           /**< not properly constructed */
-               lortensor_g,       /**< metric tensor */
-               lortensor_delta,   /**< unity matrix */
-               lortensor_epsilon, /**< four-dimensional totally antisymmetric tensor */
-               lortensor_symbolic /**< general symbolic Lorentz tensor */
-       } lortensor_types;
-
-// member functions
-
-       // other constructors
-protected:
-       lortensor(lortensor_types const lt, const std::string & n);
-       lortensor(lortensor_types const lt, const std::string & n, const ex & mu);
-       lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu);
-       lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu, const ex & rho);
-       lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma);
-       lortensor(lortensor_types const lt, const std::string & n, const exvector & iv);
-       lortensor(lortensor_types const lt, const std::string & n, unsigned s, const exvector & iv);
-       lortensor(lortensor_types const lt, const std::string & n, unsigned s, exvector * ivp);
-
-       //functions overriding virtual functions from base classes
-public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
-       bool info(unsigned inf) const;
-       ex eval(int level=0) const;
-protected:
-       bool is_equal_same_type(const basic & other) const;
-       unsigned return_type(void) const;
-       unsigned return_type_tinfo(void) const;
-       ex thisexprseq(const exvector & v) const;
-       ex thisexprseq(exvector * vp) const;
-
-       // new virtual functions which can be overridden by derived classes
-       // none
-
-       //non virtual functions in this class
-public:
-       void setname(const std::string & n) {name = n;}
-       std::string getname(void) const {return name;}
-protected:
-       bool all_of_type_lorentzidx(void) const;
-private:
-       std::string & autoname_prefix(void);
-
-       //member variables
-
-protected:
-       lortensor_types type; /**< Type of object */
-       std::string name;     /**< Name of symbolic tensor */
-       unsigned serial;      /**< Unique serial number for comparing symbolic tensors */
-private:
-       static unsigned next_serial;
-};
-
-// utility functions
-       
-inline const lortensor & ex_to_lortensor(const ex &e)
-{
-       return static_cast<const lortensor &>(*e.bp);
-}
-
-inline lortensor &ex_to_nonconst_lortensor(const ex &e)
-{
-       return static_cast<lortensor &>(*e.bp);
-}
-
-lortensor lortensor_g(const ex & mu, const ex & nu);
-lortensor lortensor_delta(const ex & mu, const ex & nu);
-lortensor lortensor_epsilon(const ex & mu, const ex & nu,
-                            const ex & rho, const ex & sigma);
-lortensor lortensor_vector(const std::string & n, const ex & mu);
-lortensor lortensor_symbolic(const std::string & name, const exvector & iv);
-
-ex simplify_lortensor_mul(const ex & m);
-ex simplify_lortensor(const ex & e);
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_LORTENSOR_H__
diff --git a/ginac/simp_lor.cpp b/ginac/simp_lor.cpp
deleted file mode 100644 (file)
index 0734439..0000000
+++ /dev/null
@@ -1,508 +0,0 @@
-/** @file simp_lor.cpp
- *
- *  Implementation of GiNaC's simp_lor objects.
- *  No real implementation yet, to be done.     */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string>
-#include <list>
-#include <algorithm>
-#include <iostream>
-#include <stdexcept>
-#include <map>
-
-#include "simp_lor.h"
-#include "ex.h"
-#include "mul.h"
-#include "archive.h"
-#include "debugmsg.h"
-#include "utils.h"
-
-namespace GiNaC {
-
-GINAC_IMPLEMENT_REGISTERED_CLASS(simp_lor, indexed)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-simp_lor::simp_lor() : type(invalid)
-{
-       debugmsg("simp_lor default constructor",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_simp_lor;
-}
-
-// protected
-
-void simp_lor::copy(const simp_lor & other)
-{
-       indexed::copy(other);
-       type=other.type;
-       name=other.name;
-}
-
-void simp_lor::destroy(bool call_parent)
-{
-       if (call_parent) {
-               indexed::destroy(call_parent);
-       }
-}
-
-//////////
-// other constructors
-//////////
-
-// protected
-
-simp_lor::simp_lor(simp_lor_types const t) : type(t)
-{
-       debugmsg("simp_lor constructor from simp_lor_types",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_simp_lor;
-}
-
-simp_lor::simp_lor(simp_lor_types const t, const ex & i1, const ex & i2)
-  : indexed(i1,i2), type(t)
-{
-       debugmsg("simp_lor constructor from simp_lor_types,ex,ex",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_simp_lor;
-       GINAC_ASSERT(all_of_type_lorentzidx());
-}
-
-simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const ex & i1)
-  : indexed(i1), type(t), name(n)
-{
-       debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_simp_lor;
-       GINAC_ASSERT(all_of_type_lorentzidx());
-}
-
-simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv)
-  : indexed(iv), type(t), name(n)
-{
-       debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_simp_lor;
-       GINAC_ASSERT(all_of_type_lorentzidx());
-}
-
-simp_lor::simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp)
-  : indexed(ivp), type(t), name(n)
-{
-       debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT);
-       tinfo_key=TINFO_simp_lor;
-       GINAC_ASSERT(all_of_type_lorentzidx());
-}
-
-//////////
-// archiving
-//////////
-
-/** Construct object from archive_node. */
-simp_lor::simp_lor(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
-       debugmsg("simp_lor constructor from archive_node", LOGLEVEL_CONSTRUCT);
-       unsigned int ty;
-       if (!(n.find_unsigned("type", ty)))
-               throw (std::runtime_error("unknown simp_lor type in archive"));
-       type = (simp_lor_types)ty;
-       n.find_string("name", name);
-}
-
-/** Unarchive the object. */
-ex simp_lor::unarchive(const archive_node &n, const lst &sym_lst)
-{
-       return (new simp_lor(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void simp_lor::archive(archive_node &n) const
-{
-       inherited::archive(n);
-       n.add_unsigned("type", type);
-       n.add_string("name", name);
-}
-
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-void simp_lor::printraw(std::ostream & os) const
-{
-       debugmsg("simp_lor printraw",LOGLEVEL_PRINT);
-       os << "simp_lor(type=" << (unsigned)type
-          << ",name=" << name << ",indices=";
-       printrawindices(os);
-       os << ",hash=" << hashvalue << ",flags=" << flags << ")";
-}
-
-void simp_lor::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("simp_lor printtree",LOGLEVEL_PRINT);
-       os << std::string(indent,' ') << "simp_lor object: "
-          << "type=" << (unsigned)type
-          << ", name=" << name << ", ";
-       os << seq.size() << " indices" << std::endl;
-       printtreeindices(os,indent);
-       os << std::string(indent,' ') << "hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void simp_lor::print(std::ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("simp_lor print",LOGLEVEL_PRINT);
-       switch (type) {
-       case simp_lor_g:
-               os << "g";
-               break;
-       case simp_lor_vec:
-               os << name;
-               break;
-       case invalid:
-       default:
-               os << "INVALID_SIMP_LOR_OBJECT";
-               break;
-       }
-       printindices(os);
-}
-
-void simp_lor::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
-{
-       debugmsg("simp_lor print csrc",LOGLEVEL_PRINT);
-       print(os,upper_precedence);
-}
-
-bool simp_lor::info(unsigned inf) const
-{
-       return indexed::info(inf);
-}
-
-ex simp_lor::eval(int level) const
-{
-       if (type==simp_lor_g) {
-               // canonicalize indices
-               exvector iv=seq;
-               int sig=canonicalize_indices(iv,false); // symmetric
-               if (sig!=INT_MAX) {
-                       // something has changed while sorting indices, more evaluations later
-                       if (sig==0) return _ex0();
-                       return ex(sig)*simp_lor(type,name,iv);
-               }
-               const lorentzidx & idx1=ex_to_lorentzidx(seq[0]);
-               const lorentzidx & idx2=ex_to_lorentzidx(seq[1]);
-               if ((!idx1.is_symbolic())&&(!idx2.is_symbolic())) {
-                       // both indices are numeric
-                       if ((idx1.get_value()==idx2.get_value())) {
-                               // both on diagonal
-                               if (idx1.get_value()==0) {
-                                       // (0,0)
-                                       return _ex1();
-                               } else {
-                                       if (idx1.is_covariant()!=idx2.is_covariant()) {
-                                               // (_i,~i) or (~i,_i), i=1..3
-                                               return _ex1();
-                                       } else {
-                                               // (_i,_i) or (~i,~i), i=1..3
-                                               return _ex_1();
-                                       }
-                               }
-                       } else {
-                               // at least one off-diagonal
-                               return _ex0();
-                       }
-               } else if (idx1.is_symbolic() && idx1.is_co_contra_pair(idx2)) {
-                       if (idx1.is_orthogonal_only())
-                               return Dim() - idx1.get_dim_parallel_space();
-                       else
-                               return Dim();
-               }
-       }
-
-       return this->hold();
-}
-       
-// protected
-
-int simp_lor::compare_same_type(const basic & other) const
-{
-       GINAC_ASSERT(other.tinfo() == TINFO_simp_lor);
-       const simp_lor *o = static_cast<const simp_lor *>(&other);
-       if (type==o->type) {
-               if (name==o->name) {
-                       return indexed::compare_same_type(other);
-               }
-               return name.compare(o->name);
-       }
-       return type < o->type ? -1 : 1;
-}
-
-bool simp_lor::is_equal_same_type(const basic & other) const
-{
-       GINAC_ASSERT(other.tinfo() == TINFO_simp_lor);
-       const simp_lor *o = static_cast<const simp_lor *>(&other);
-       if (type!=o->type) return false;
-       if (name!=o->name) return false;
-       return indexed::is_equal_same_type(other);
-}
-
-unsigned simp_lor::return_type(void) const
-{
-       return return_types::commutative;
-}
-   
-unsigned simp_lor::return_type_tinfo(void) const
-{
-       return tinfo_key;
-}
-
-ex simp_lor::thisexprseq(const exvector & v) const
-{
-       return simp_lor(type,name,v);
-}
-
-ex simp_lor::thisexprseq(exvector * vp) const
-{
-       return simp_lor(type,name,vp);
-}
-
-//////////
-// virtual functions which can be overridden by derived classes
-//////////
-
-// none
-
-//////////
-// non-virtual functions in this class
-//////////
-
-// protected
-
-bool simp_lor::all_of_type_lorentzidx(void) const
-{
-       // used only inside of ASSERTs
-       for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
-               if (!is_ex_of_type(*cit,lorentzidx)) return false;
-       }
-       return true;
-}
-
-//////////
-// static member variables
-//////////
-
-// none
-
-//////////
-// friend functions
-//////////
-
-simp_lor lor_g(const ex & mu, const ex & nu)
-{
-       return simp_lor(simp_lor::simp_lor_g,mu,nu);
-}
-
-simp_lor lor_vec(const std::string & n, const ex & mu)
-{
-       return simp_lor(simp_lor::simp_lor_vec,n,mu);
-}
-
-ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp)
-{
-       GINAC_ASSERT(is_ex_exactly_of_type(m,mul));
-       exvector v_contracted;
-
-       // collect factors in an exvector, store squares twice
-       unsigned n=m.nops();
-       v_contracted.reserve(2*n);
-       for (unsigned i=0; i<n; ++i) {
-               ex f=m.op(i);
-               if (is_ex_exactly_of_type(f,power)&&f.op(1).is_equal(_ex2())) {
-                       v_contracted.push_back(f.op(0));
-                       v_contracted.push_back(f.op(0));
-               } else {
-                       v_contracted.push_back(f);
-               }
-       }
-
-       unsigned replacements;
-       bool something_changed=false;
-
-       exvector::iterator it=v_contracted.begin();
-       while (it!=v_contracted.end()) {
-               // process only lor_g objects
-               if (is_ex_exactly_of_type(*it,simp_lor) &&
-                       (ex_to_simp_lor(*it).type==simp_lor::simp_lor_g)) {
-                       const simp_lor & g=ex_to_simp_lor(*it);
-                       GINAC_ASSERT(g.seq.size()==2);
-                       const idx & first_idx=ex_to_lorentzidx(g.seq[0]);
-                       const idx & second_idx=ex_to_lorentzidx(g.seq[1]);
-                       // g_{mu,mu} should have been contracted in simp_lor::eval()
-                       GINAC_ASSERT(!first_idx.is_equal(second_idx));
-                       ex saved_g=*it; // save to restore it later
-
-                       // try to contract first index
-                       replacements=0;
-                       if (first_idx.is_symbolic()) {
-                               replacements = subs_index_in_exvector(v_contracted, first_idx.toggle_covariant(),second_idx);
-                               if (replacements==0) {
-                                       // not contracted, restore g object
-                                       *it=saved_g;
-                               } else {
-                                       // a contracted index should occur exactly once
-                                       GINAC_ASSERT(replacements==1);
-                                       *it=_ex1();
-                                       something_changed=true;
-                               }
-                       }
-
-                       // try second index only if first was not contracted
-                       if ((replacements==0)&&(second_idx.is_symbolic())) {
-                               // first index not contracted, *it is again the original g object
-                               replacements = subs_index_in_exvector(v_contracted, second_idx.toggle_covariant(),first_idx);
-                               if (replacements==0) {
-                                       // not contracted except in itself, restore g object
-                                       *it=saved_g;
-                               } else {
-                                       // a contracted index should occur exactly once
-                                       GINAC_ASSERT(replacements==1);
-                                       *it=_ex1();
-                                       something_changed=true;
-                               }
-                       }
-               }
-               ++it;
-       }
-
-       // process only lor_vec objects
-       bool jump_to_next=false;
-       exvector::iterator it1=v_contracted.begin();
-       while (it1!=v_contracted.end()-1) {
-               if (is_ex_exactly_of_type(*it1,simp_lor) && 
-                       (ex_to_simp_lor(*it1).type==simp_lor::simp_lor_vec)) {
-                       exvector::iterator it2=it1+1;
-                       while ((it2!=v_contracted.end())&&!jump_to_next) {
-                               if (is_ex_exactly_of_type(*it2,simp_lor) && 
-                                       (ex_to_simp_lor(*it2).type==simp_lor::simp_lor_vec)) {
-                                       const simp_lor & vec1=ex_to_simp_lor(*it1);
-                                       const simp_lor & vec2=ex_to_simp_lor(*it2);
-                                       GINAC_ASSERT(vec1.seq.size()==1);
-                                       GINAC_ASSERT(vec2.seq.size()==1);
-                                       const lorentzidx & idx1=ex_to_lorentzidx(vec1.seq[0]);
-                                       const lorentzidx & idx2=ex_to_lorentzidx(vec2.seq[0]);
-                                       if (idx1.is_symbolic() &&
-                                               idx1.is_co_contra_pair(idx2) &&
-                                               sp.is_defined(vec1,vec2)) {
-                                               *it1=sp.evaluate(vec1,vec2);
-                                               *it2=_ex1();
-                                               something_changed=true;
-                                               jump_to_next=true;
-                                       }
-                               }
-                               ++it2;
-                       }
-                       jump_to_next=false;
-               }
-               ++it1;
-       }
-       if (something_changed) {
-               return mul(v_contracted);
-       }
-       return m;
-}
-
-ex simplify_simp_lor(const ex & e, const scalar_products & sp)
-{
-       // all simplification is done on expanded objects
-       ex e_expanded = e.expand();
-
-       // simplification of sum=sum of simplifications
-       if (is_ex_exactly_of_type(e_expanded,add)) {
-               ex sum=_ex0();
-               for (unsigned i=0; i<e_expanded.nops(); ++i)
-                       sum += simplify_simp_lor(e_expanded.op(i),sp);
-
-               return sum;
-       }
-
-       // simplification of commutative product=commutative product of simplifications
-       if (is_ex_exactly_of_type(e_expanded,mul)) {
-               return simplify_simp_lor_mul(e,sp);
-       }
-
-       // cannot do anything
-       return e_expanded;
-}
-
-//////////
-// helper classes
-//////////
-
-void scalar_products::reg(const simp_lor & v1, const simp_lor & v2,
-                          const ex & sp)
-{
-       if (v1.compare_same_type(v2)>0) {
-               reg(v2,v1,sp);
-               return;
-       }
-       spm[make_key(v1,v2)]=sp;
-}
-
-bool scalar_products::is_defined(const simp_lor & v1, const simp_lor & v2) const
-{
-       if (v1.compare_same_type(v2)>0) {
-               return is_defined(v2,v1);
-       }
-       return spm.find(make_key(v1,v2))!=spm.end();
-}
-
-ex scalar_products::evaluate(const simp_lor & v1, const simp_lor & v2) const
-{
-       if (v1.compare_same_type(v2)>0)
-               return evaluate(v2, v1);
-       
-       return (*spm.find(make_key(v1,v2))).second;
-}
-
-void scalar_products::debugprint(void) const
-{
-       std::cerr << "map size=" << spm.size() << std::endl;
-       for (spmap::const_iterator cit=spm.begin(); cit!=spm.end(); ++cit) {
-               const spmapkey & k=(*cit).first;
-               std::cerr << "item key=((" << k.first.first
-                         << "," << k.first.second << "),";
-               k.second.printraw(std::cerr);
-               std::cerr << ") value=" << (*cit).second << std::endl;
-       }
-}
-
-spmapkey scalar_products::make_key(const simp_lor & v1, const simp_lor & v2)
-{
-       GINAC_ASSERT(v1.type==simp_lor::simp_lor_vec);
-       GINAC_ASSERT(v2.type==simp_lor::simp_lor_vec);
-       lorentzidx anon=ex_to_lorentzidx(v1.seq[0]).create_anonymous_representative();
-       GINAC_ASSERT(anon.is_equal_same_type(ex_to_lorentzidx(v2.seq[0]).create_anonymous_representative()));
-       return spmapkey(strstrpair(v1.name,v2.name),anon);
-}
-
-} // namespace GiNaC
diff --git a/ginac/simp_lor.h b/ginac/simp_lor.h
deleted file mode 100644 (file)
index 1fcf84f..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/** @file simp_lor.h
- *
- *  Interface to GiNaC's simp_lor objects. */
-
-/*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef _SIMP__GINAC_LOR_H__
-#define _SIMP__GINAC_LOR_H__
-
-#include <string>
-#include <vector>
-#include <utility>
-#include <map>
-#include <iostream>
-#include "indexed.h"
-#include "lorentzidx.h"
-
-namespace GiNaC {
-
-typedef std::pair<std::string,std::string> strstrpair;
-typedef std::pair<strstrpair,lorentzidx> spmapkey;
-
-class spmapkey_is_less
-{
-public:
-       bool operator()(const spmapkey & lh, const spmapkey & rh) const
-       {
-               bool res = lh.first<rh.first
-                       || (!(rh.first<lh.first) && lh.second.compare(rh.second)<0);
-               return res;
-       }
-};
-
-typedef std::map<spmapkey,ex,spmapkey_is_less> spmap;
-
-class simp_lor;
-
-/** helper class for scalar products */
-class scalar_products
-{
-public:
-       void reg(const simp_lor & v1, const simp_lor & v2, const ex & sp);
-       bool is_defined(const simp_lor & v1, const simp_lor & v2) const;
-       ex evaluate(const simp_lor & v1, const simp_lor & v2) const;
-       void debugprint(void) const;
-protected:
-       static spmapkey make_key(const simp_lor & v1, const simp_lor & v2);
-protected:
-       spmap spm;
-};
-
-/** Base class for simp_lor object */
-class simp_lor : public indexed
-{
-       GINAC_DECLARE_REGISTERED_CLASS(simp_lor, indexed)
-
-// friends
-
-       friend class scalar_products;
-       friend simp_lor lor_g(const ex & mu, const ex & nu);
-       friend simp_lor lor_vec(const std::string & n, const ex & mu);
-       friend ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
-       friend ex simplify_simp_lor(const ex & e, const scalar_products & sp);
-       
-// types
-
-public:
-       typedef enum {
-               invalid, // not properly constructed by one of the friend functions
-               simp_lor_g,
-               simp_lor_vec
-       } simp_lor_types;
-       
-       // other constructors
-protected:
-       simp_lor(simp_lor_types const t);
-       simp_lor(simp_lor_types const t, const ex & i1, const ex & i2);
-       simp_lor(simp_lor_types const t, const std::string & n, const ex & i1);
-       simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv);
-       simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp);
-       
-       // functions overriding virtual functions from base classes
-public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
-       void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
-       bool info(unsigned inf) const;
-       ex eval(int level=0) const;
-protected:
-       bool is_equal_same_type(const basic & other) const;
-       unsigned return_type(void) const;
-       unsigned return_type_tinfo(void) const;
-       ex thisexprseq(const exvector & v) const;
-       ex thisexprseq(exvector * vp) const;
-
-       // new virtual functions which can be overridden by derived classes
-       // none
-       
-       // non-virtual functions in this class
-protected:
-       bool all_of_type_lorentzidx(void) const;
-       
-// member variables
-
-protected:
-       simp_lor_types type;
-       std::string name;
-};
-
-// utility functions
-inline const simp_lor &ex_to_simp_lor(const ex &e)
-{
-       return static_cast<const simp_lor &>(*e.bp);
-}
-
-inline simp_lor &ex_to_nonconst_simp_lor(const ex &e)
-{
-       return static_cast<simp_lor &>(*e.bp);
-}
-
-simp_lor lor_g(const ex & mu, const ex & nu);
-simp_lor lor_vec(const std::string & n, const ex & mu);
-ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
-ex simplify_simp_lor(const ex & e, const scalar_products & sp=scalar_products());
-
-} // namespace GiNaC
-
-#endif // ndef _SIMP__GINAC_LOR_H__