]> www.ginac.de Git - ginac.git/blobdiff - ginac/indexed.h
documented symmetrize() and antisymmetrize()
[ginac.git] / ginac / indexed.h
index b15ed8b30ec892975e322178fb6f32da7f0b222a..fd85b8db25cfa055805e78a2547d63b40229b273 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,11 +151,12 @@ 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;
+       int ldegree(const ex & s) const;
+       ex coeff(const ex & s, int n = 1) const;
        exvector get_free_indices(void) const;
 
 protected:
@@ -173,11 +174,23 @@ public:
         *  @see class info_flags */
        bool all_index_values_are(unsigned inf) const;
 
+       /** Return a vector containing the object's indices. */
+       exvector get_indices(void) const;
+
+       /** Return a vector containing the dummy indices of the object, if any. */
+       exvector get_dummy_indices(void) const;
+
+       /** Return a vector containing the dummy indices in the contraction with
+        *  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;
-       bool all_indices_of_type_idx(void) const;
+       void printindices(const print_context & c, unsigned level) const;
+       void assert_all_indices_of_type_idx(void) const;
 
        // member variables
 protected:
@@ -206,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);
 
@@ -245,6 +263,11 @@ ex simplify_indexed(const ex & e);
  *  @return simplified expression */
 ex simplify_indexed(const ex & e, const scalar_products & sp);
 
+/** Symmetrize expression over its free indices. */
+ex symmetrize(const ex & e);
+
+/** Antisymmetrize expression over its free indices. */
+ex antisymmetrize(const ex & e);
 
 } // namespace GiNaC