From 50dc516836ac5e91f4f60a60b9a307b375247e7c Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Thu, 5 Apr 2001 21:02:26 +0000 Subject: [PATCH] subs() performs "syntactic substitution" as in Maple; you can substitute any object by any other object (even numerics) but only when the object subs() is called on exactly matches an object on the left-hand side of the substitution list; expairseq still doesn't substitute its numeric coefficients so substituting numerics will not replace them in all occurences (this shouldn't matter, though) --- ginac/basic.cpp | 39 ++++++++++++++++++--------------------- ginac/container.pl | 6 +++--- ginac/expairseq.cpp | 2 +- ginac/function.pl | 14 -------------- ginac/indexed.cpp | 13 ------------- ginac/indexed.h | 1 - ginac/power.cpp | 2 +- ginac/symbol.cpp | 13 ------------- ginac/symbol.h | 1 - ginac/tensor.cpp | 12 ------------ ginac/tensor.h | 2 -- 11 files changed, 23 insertions(+), 82 deletions(-) diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 1b388259..c4e17cd5 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -31,10 +31,6 @@ #include "symbol.h" #include "lst.h" #include "ncmul.h" -#include "idx.h" -#include "indexed.h" -#include "tensor.h" -#include "function.h" #include "archive.h" #include "utils.h" #include "debugmsg.h" @@ -341,10 +337,17 @@ bool basic::contract_with(exvector::iterator self, exvector::iterator other, exv return false; } -/** Substitute a set of symbols by arbitrary expressions. The ex returned +/** Substitute a set of objects by arbitrary expressions. The ex returned * will already be evaluated. */ ex basic::subs(const lst & ls, const lst & lr) const { + GINAC_ASSERT(ls.nops() == lr.nops()); + + for (unsigned i=0; i