]> www.ginac.de Git - ginac.git/commitdiff
Allow, optionally, indices to be substituted by things that are not indices.
authorChris Dams <Chris.Dams@mi.infn.it>
Fri, 7 Jul 2006 13:35:29 +0000 (13:35 +0000)
committerChris Dams <Chris.Dams@mi.infn.it>
Fri, 7 Jul 2006 13:35:29 +0000 (13:35 +0000)
ginac/flags.h
ginac/idx.cpp

index 6cf3ea94dde8b34e88b477d6d075ec7d97e3525c..8ef1c0ac07e03a72f8482a431b886543b3bbfc1a 100644 (file)
@@ -52,7 +52,11 @@ public:
                subs_algebraic = 0x0002,  // for backwards compatibility
                pattern_is_product = 0x0004,     ///< used internally by expairseq::subschildren()
                pattern_is_not_product = 0x0008, ///< used internally by expairseq::subschildren()
                subs_algebraic = 0x0002,  // for backwards compatibility
                pattern_is_product = 0x0004,     ///< used internally by expairseq::subschildren()
                pattern_is_not_product = 0x0008, ///< used internally by expairseq::subschildren()
-               no_index_renaming = 0x0010
+               no_index_renaming = 0x0010,
+               // To indicate that we want to substitue an index by something that is
+               // is not an index. Without this flag the index value would be
+               // substituted in that case.
+               really_subs_idx = 0x0020
        };
 };
 
        };
 };
 
index e531f0f3299636d102fd4ff1f41fed0a7656bf82..73af6aac1333e588b6b05bcc5b7e9bdf3c19c37c 100644 (file)
@@ -365,7 +365,7 @@ ex idx::subs(const exmap & m, unsigned options) const
        if (it != m.end()) {
 
                // Substitution index->index
        if (it != m.end()) {
 
                // Substitution index->index
-               if (is_a<idx>(it->second))
+               if (is_a<idx>(it->second) || (options & subs_options::really_subs_idx))
                        return it->second;
 
                // Otherwise substitute value
                        return it->second;
 
                // Otherwise substitute value