X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Findexed.cpp;h=0360d3416fc9f5c372b933efd4ffba427807f006;hp=c8b710ae7f1e63690cbb0356e2e1ccc10159f1e0;hb=dd19b7316b6eba5c49b6a4fb3503c504ec6c866a;hpb=67467d256b44f5e08498ca81c946d9ffaa25d1e2 diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index c8b710ae..0360d341 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's indexed expressions. */ /* - * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2009 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 @@ -20,11 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include -#include - #include "indexed.h" #include "idx.h" #include "add.h" @@ -42,6 +37,11 @@ #include "matrix.h" #include "inifcns.h" +#include +#include +#include +#include + namespace GiNaC { GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(indexed, exprseq, @@ -55,7 +55,6 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(indexed, exprseq, indexed::indexed() : symtree(not_symmetric()) { - tinfo_key = &indexed::tinfo_static; } ////////// @@ -64,87 +63,75 @@ indexed::indexed() : symtree(not_symmetric()) 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 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; @@ -163,6 +150,7 @@ indexed::indexed(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) const_cast(ex_to(symtree)).validate(seq.size() - 1); } } +GINAC_BIND_UNARCHIVER(indexed); void indexed::archive(archive_node &n) const { @@ -170,8 +158,6 @@ void indexed::archive(archive_node &n) const n.add_ex("symmetry", symtree); } -DEFAULT_UNARCHIVE(indexed) - ////////// // functions overriding virtual functions from base classes ////////// @@ -299,7 +285,7 @@ ex indexed::eval(int level) const return f * thiscontainer(v); } - if(this->tinfo()==&indexed::tinfo_static && seq.size()==1) + if((typeid(*this) == typeid(indexed)) && seq.size()==1) return base; // Canonicalize indices according to the symmetry properties @@ -1409,7 +1395,7 @@ exvector get_all_dummy_indices_safely(const ex & e) else if (is_a(e) || is_a(e)) { exvector dummies; exvector free_indices; - for (int i=0; i(e)) { exvector result; - for(int i=0; i