]> www.ginac.de Git - ginac.git/blobdiff - ginac/indexed.h
- added lst::remove_first() and lst::remove_last()
[ginac.git] / ginac / indexed.h
index e98375d38165d56610fe1e72a111e8412f705711..babb9c224de0ab72b994ed9b33eec8b6abafd4b9 100644 (file)
@@ -39,8 +39,8 @@ class indexed : public exprseq
 {
        GINAC_DECLARE_REGISTERED_CLASS(indexed, exprseq)
 
-       friend ex simplify_indexed(const ex & e, exvector & free_indices, const scalar_products & sp);
-       friend ex simplify_indexed_product(const ex & e, exvector & free_indices, const scalar_products & sp);
+       friend ex simplify_indexed(const ex & e, exvector & free_indices, exvector & dummy_indices, const scalar_products & sp);
+       friend ex simplify_indexed_product(const ex & e, exvector & free_indices, exvector & dummy_indices, const scalar_products & sp);
 
        // types
 public:
@@ -151,9 +151,7 @@ public:
 
        // functions overriding virtual functions from base classes
 public:
-       void printraw(std::ostream & os) const;
-       void printtree(std::ostream & os, unsigned indent) const;
-       void print(std::ostream & os, unsigned upper_precedence=0) const;
+       void print(const print_context & c, unsigned level = 0) const;
        bool info(unsigned inf) const;
        ex eval(int level = 0) const;
        int degree(const ex & s) const;
@@ -186,10 +184,12 @@ public:
         *  another indexed object. */
        exvector get_dummy_indices(const indexed & other) const;
 
+       /** Check whether the object has an index that forms a dummy index pair
+        *  with a given index. */
+       bool has_dummy_index_for(const ex & i) const;
+
 protected:
-       void printrawindices(std::ostream & os) const;
-       void printtreeindices(std::ostream & os, unsigned indent) const;
-       void printindices(std::ostream & os) const;
+       void printindices(const print_context & c, unsigned level) const;
        void assert_all_indices_of_type_idx(void) const;
 
        // member variables
@@ -219,6 +219,11 @@ public:
        /** Register scalar product pair and its value. */
        void add(const ex & v1, const ex & v2, const ex & sp);
 
+       /** Register list of vectors. This adds all possible pairs of products
+        *  a.i * b.i with the value a*b (note that this is not a scalar vector
+        *  product but an ordinary product of scalars). */
+       void add_vectors(const lst & l);
+
        /** Clear all registered scalar products. */
        void clear(void);
 
@@ -239,26 +244,6 @@ inline const indexed &ex_to_indexed(const ex &e)
        return static_cast<const indexed &>(*e.bp);
 }
 
-
-/** Simplify/canonicalize expression containing indexed objects. This
- *  performs contraction of dummy indices where possible and checks whether
- *  the free indices in sums are consistent.
- *
- *  @param e The expression to be simplified
- *  @return simplified expression */
-ex simplify_indexed(const ex & e);
-
-/** Simplify/canonicalize expression containing indexed objects. This
- *  performs contraction of dummy indices where possible, checks whether
- *  the free indices in sums are consistent, and automatically replaces
- *  scalar products by known values if desired.
- *
- *  @param e The expression to be simplified
- *  @param sp Scalar products to be replaced automatically
- *  @return simplified expression */
-ex simplify_indexed(const ex & e, const scalar_products & sp);
-
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_INDEXED_H__