Cadabra
Computer algebra system for field theory problems
evaluate.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "Compare.hh"
5 
6 
11 
90 #include "Algorithm.hh"
91 #include "properties/Indices.hh"
92 
93 namespace cadabra {
94 
95  class evaluate : public Algorithm {
96  public:
97  evaluate(const Kernel&, Ex&, const Ex& component_values, bool rhs=false, bool simplify=true);
98 
99  virtual bool can_apply(iterator) override;
100  virtual result_t apply(iterator&) override;
101 
105  void merge_components(iterator it1, iterator it2);
106 
107  private:
108  const Ex& components;
110 
111  bool is_component(iterator it) const;
112  bool is_scalar_function(iterator it) const;
113 
119 
123 
124  iterator handle_factor(sibling_iterator sib, const index_map_t& full_ind_free);
125 
129  iterator dense_factor(iterator sib, const index_map_t& ind_free, const index_map_t& ind_dummy);
130 
134 
137  void cleanup_components(iterator it1);
138 
142 
145 
148 
151  std::set<Ex, tree_exact_less_obj> dependencies(iterator it);
152  };
153 
154  }
Base class for all algorithms, containing generic routines and in particular the logic for index clas...
Definition: Algorithm.hh:59
Ex::iterator iterator
Definition: Algorithm.hh:70
Ex::sibling_iterator sibling_iterator
Definition: Algorithm.hh:72
Basic storage class for symbolic mathemematical expressions.
Definition: Storage.hh:142
result_t
Keeping track of what algorithms have done to this expression.
Definition: Storage.hh:164
std::multimap< Ex, Ex::iterator, tree_exact_less_for_indexmap_obj > index_map_t
A map from a pattern to the position where it occurs in the tree.
Definition: IndexClassifier.hh:23
Definition: Kernel.hh:15
Definition: evaluate.hh:95
evaluate(const Kernel &, Ex &, const Ex &component_values, bool rhs=false, bool simplify=true)
Definition: evaluate.cc:21
virtual bool can_apply(iterator) override
Definition: evaluate.cc:26
iterator handle_components(iterator it)
Definition: evaluate.cc:127
bool is_component(iterator it) const
Definition: evaluate.cc:107
void simplify_components(iterator)
Simplify all components of a 'components' node by running sympy's simplify on them.
Definition: evaluate.cc:1047
bool is_scalar_function(iterator it) const
Definition: evaluate.cc:31
void merge_component_children(iterator it)
Merge entries in a single 'components' node when they are for the same index value(s).
Definition: evaluate.cc:462
void cleanup_components(iterator it1)
Cleanup all components in a 'components' node; that is, call the cleanup_dispatch function on them.
Definition: evaluate.cc:588
bool only_rhs
Definition: evaluate.hh:109
iterator handle_prod(iterator it)
Definition: evaluate.cc:1179
virtual result_t apply(iterator &) override
Definition: evaluate.cc:37
std::set< Ex, tree_exact_less_obj > dependencies(iterator it)
Determine all the Coordinate dependencies of the object at 'it'.
Definition: evaluate.cc:1086
iterator handle_derivative(iterator it)
Definition: evaluate.cc:602
iterator dense_factor(iterator sib, const index_map_t &ind_free, const index_map_t &ind_dummy)
Expand a tensor factor into a components node with all components written out explicitly.
Definition: evaluate.cc:388
iterator handle_epsilon(iterator it)
Definition: evaluate.cc:1004
const Ex & components
Definition: evaluate.hh:108
void merge_components(iterator it1, iterator it2)
Merge the information in two 'components' nodes at the given iterators, moving all out of the second ...
Definition: evaluate.cc:506
iterator wrap_scalar_in_components_node(iterator sib)
Wrap a non-component scalar node in a 'components' node.
Definition: evaluate.cc:1155
void unwrap_scalar_in_components_node(iterator sib)
Inverse of the above.
Definition: evaluate.cc:1165
bool call_sympy
Definition: evaluate.hh:109
iterator handle_sum(iterator it)
Definition: evaluate.cc:142
iterator handle_factor(sibling_iterator sib, const index_map_t &full_ind_free)
Replace a single factor with a 'components' ...
Definition: evaluate.cc:229
General purpose brute force scalar simplification algorithm.
Definition: simplify.hh:15
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83
Ex rhs(Ex_ptr ex)
Definition: py_ex.cc:391