* Implementation of GiNaC's simp_lor objects.
* No real implementation yet, to be done. */
+/*
+ * GiNaC Copyright (C) 1999 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 <stdexcept>
#include <map>
-#include "ginac.h"
+#include "simp_lor.h"
+#include "ex.h"
+#include "mul.h"
+#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
simp_lor::simp_lor() : type(invalid)
{
debugmsg("simp_lor default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key=TINFO_SIMP_LOR;
+ tinfo_key=TINFO_simp_lor;
}
simp_lor::~simp_lor()
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;
+ tinfo_key=TINFO_simp_lor;
}
simp_lor::simp_lor(simp_lor_types const t, ex const & i1, ex const & i2) :
indexed(i1,i2), type(t)
{
debugmsg("simp_lor constructor from simp_lor_types,ex,ex",LOGLEVEL_CONSTRUCT);
- tinfo_key=TINFO_SIMP_LOR;
+ tinfo_key=TINFO_simp_lor;
ASSERT(all_of_type_lorentzidx());
}
indexed(i1), type(t), name(n)
{
debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT);
- tinfo_key=TINFO_SIMP_LOR;
+ tinfo_key=TINFO_simp_lor;
ASSERT(all_of_type_lorentzidx());
}
indexed(iv), type(t), name(n)
{
debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT);
- tinfo_key=TINFO_SIMP_LOR;
+ tinfo_key=TINFO_simp_lor;
ASSERT(all_of_type_lorentzidx());
}
indexed(ivp), type(t), name(n)
{
debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT);
- tinfo_key=TINFO_SIMP_LOR;
+ tinfo_key=TINFO_simp_lor;
ASSERT(all_of_type_lorentzidx());
}
int simp_lor::compare_same_type(basic const & other) const
{
- ASSERT(other.tinfo() == TINFO_SIMP_LOR);
+ ASSERT(other.tinfo() == TINFO_simp_lor);
const simp_lor *o = static_cast<const simp_lor *>(&other);
if (type==o->type) {
if (name==o->name) {
bool simp_lor::is_equal_same_type(basic const & other) const
{
- ASSERT(other.tinfo() == TINFO_SIMP_LOR);
+ 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;
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)==2) {
+ if (is_ex_exactly_of_type(f,power)&&f.op(1).is_equal(exTWO())) {
v_contracted.push_back(f.op(0));
v_contracted.push_back(f.op(0));
} else {
return spmapkey(strstrpair(v1.name,v2.name),anon);
}
-
-
+} // namespace GiNaC