X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fadd.cpp;h=0f25d2dc7a444a29fa11d513dad89ea6e896cc14;hp=0d88e329316c64b93eb5640a15983cb3ea56c43e;hb=f50359e46371c8f9ece3c0fcf0d226b9e649baad;hpb=6b3768e8c544739ae53321539cb4d1e3112ded1b diff --git a/ginac/add.cpp b/ginac/add.cpp index 0d88e329..0f25d2dc 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -2,10 +2,32 @@ * * Implementation of GiNaC's sums of expressions. */ +/* + * 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 #include -#include "ginac.h" +#include "add.h" +#include "mul.h" +#include "debugmsg.h" + +namespace GiNaC { ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -16,7 +38,7 @@ add::add() { debugmsg("add default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; } add::~add() @@ -62,7 +84,7 @@ void add::destroy(bool call_parent) add::add(ex const & lh, ex const & rh) { debugmsg("add constructor from ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_2_ex(lh,rh); ASSERT(is_canonical()); @@ -71,7 +93,7 @@ add::add(ex const & lh, ex const & rh) add::add(exvector const & v) { debugmsg("add constructor from exvector",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_exvector(v); ASSERT(is_canonical()); @@ -81,7 +103,7 @@ add::add(exvector const & v) add::add(epvector const & v, bool do_not_canonicalize) { debugmsg("add constructor from epvector,bool",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; if (do_not_canonicalize) { seq=v; #ifdef EXPAIRSEQ_USE_HASHTAB @@ -97,7 +119,7 @@ add::add(epvector const & v, bool do_not_canonicalize) add::add(epvector const & v) { debugmsg("add constructor from epvector",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_epvector(v); ASSERT(is_canonical()); @@ -106,7 +128,7 @@ add::add(epvector const & v) add::add(epvector const & v, ex const & oc) { debugmsg("add constructor from epvector,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=oc; construct_from_epvector(v); ASSERT(is_canonical()); @@ -115,7 +137,7 @@ add::add(epvector const & v, ex const & oc) add::add(epvector * vp, ex const & oc) { debugmsg("add constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; ASSERT(vp!=0); overall_coeff=oc; construct_from_epvector(*vp); @@ -401,9 +423,9 @@ ex add::eval(int level) const exvector add::get_indices(void) const { - // all terms in the sum should have the same indices (compatible tensors) - // however this is not checked, since there is no function yet which - // compares indices (idxvector can be unsorted) !!!!!!!!!!! + // FIXME: all terms in the sum should have the same indices (compatible + // tensors) however this is not checked, since there is no function yet + // which compares indices (idxvector can be unsorted) if (seq.size()==0) { return exvector(); } @@ -631,5 +653,4 @@ unsigned add::precedence=40; const add some_add; type_info const & typeid_add=typeid(some_add); - - +} // namespace GiNaC