* Implementation of GiNaC's indexed expressions. */
/*
- * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2010 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-#include <limits>
-
#include "indexed.h"
#include "idx.h"
#include "add.h"
#include "matrix.h"
#include "inifcns.h"
+#include <iostream>
+#include <limits>
+#include <sstream>
+#include <stdexcept>
+
namespace GiNaC {
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(indexed, exprseq,
indexed::indexed() : symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
}
//////////
indexed::indexed(const ex & b) : inherited(b), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1) : inherited(b, i1), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const exvector & v) : inherited(b), symtree(not_symmetric())
{
seq.insert(seq.end(), v.begin(), v.end());
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const exvector & v) : inherited(b), symtree(symm)
{
seq.insert(seq.end(), v.begin(), v.end());
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const symmetry & symm, const exprseq & es) : inherited(es), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
}
indexed::indexed(const symmetry & symm, const exvector & v, bool discardable) : inherited(v, discardable), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
}
indexed::indexed(const symmetry & symm, std::auto_ptr<exvector> vp) : inherited(vp), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
}
//////////
// archiving
//////////
-indexed::indexed(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst)
+void indexed::read_archive(const archive_node &n, lst &sym_lst)
{
+ inherited::read_archive(n, sym_lst);
if (!n.find_ex("symmetry", symtree, sym_lst)) {
// GiNaC versions <= 0.9.0 had an unsigned "symmetry" property
unsigned symm = 0;
const_cast<symmetry &>(ex_to<symmetry>(symtree)).validate(seq.size() - 1);
}
}
+GINAC_BIND_UNARCHIVER(indexed);
void indexed::archive(archive_node &n) const
{
n.add_ex("symmetry", symtree);
}
-DEFAULT_UNARCHIVE(indexed)
-
//////////
// functions overriding virtual functions from base classes
//////////