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  }
Indices.hh
cadabra::evaluate::is_component
bool is_component(iterator it) const
Definition: evaluate.cc:107
cadabra::evaluate::handle_prod
iterator handle_prod(iterator it)
Definition: evaluate.cc:1179
cadabra::Algorithm::sibling_iterator
Ex::sibling_iterator sibling_iterator
Definition: Algorithm.hh:72
cadabra::evaluate::handle_factor
iterator handle_factor(sibling_iterator sib, const index_map_t &full_ind_free)
Replace a single factor with a 'components' ...
Definition: evaluate.cc:229
Algorithm.hh
cadabra::IndexClassifier::index_map_t
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
cadabra::evaluate::simplify_components
void simplify_components(iterator)
Simplify all components of a 'components' node by running sympy's simplify on them.
Definition: evaluate.cc:1047
cadabra::Kernel
Definition: Kernel.hh:15
cadabra::evaluate::handle_sum
iterator handle_sum(iterator it)
Definition: evaluate.cc:142
cadabra::evaluate::handle_derivative
iterator handle_derivative(iterator it)
Definition: evaluate.cc:602
cadabra::evaluate::components
const Ex & components
Definition: evaluate.hh:108
cadabra::evaluate
Definition: evaluate.hh:95
cadabra::simplify
Definition: simplify.hh:15
cadabra::evaluate::merge_components
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
cadabra::rhs
Ex rhs(Ex_ptr ex)
Definition: py_ex.cc:318
Compare.hh
cadabra::evaluate::evaluate
evaluate(const Kernel &, Ex &, const Ex &component_values, bool rhs=false, bool simplify=true)
Definition: evaluate.cc:21
cadabra::evaluate::wrap_scalar_in_components_node
iterator wrap_scalar_in_components_node(iterator sib)
Wrap a non-component scalar node in a 'components' node.
Definition: evaluate.cc:1155
cadabra::evaluate::is_scalar_function
bool is_scalar_function(iterator it) const
Definition: evaluate.cc:31
cadabra::Algorithm::iterator
Ex::iterator iterator
Definition: Algorithm.hh:70
cadabra::evaluate::apply
virtual result_t apply(iterator &) override
Definition: evaluate.cc:37
cadabra::Algorithm
Definition: Algorithm.hh:59
cadabra::evaluate::merge_component_children
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
cadabra
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83
cadabra::Ex
Definition: Storage.hh:140
cadabra::evaluate::unwrap_scalar_in_components_node
void unwrap_scalar_in_components_node(iterator sib)
Inverse of the above.
Definition: evaluate.cc:1165
cadabra::evaluate::handle_epsilon
iterator handle_epsilon(iterator it)
Definition: evaluate.cc:1004
cadabra::evaluate::dense_factor
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
cadabra::evaluate::can_apply
virtual bool can_apply(iterator) override
Definition: evaluate.cc:26
cadabra::Ex::result_t
result_t
Keeping track of what algorithms have done to this expression.
Definition: Storage.hh:159
cadabra::evaluate::dependencies
std::set< Ex, tree_exact_less_obj > dependencies(iterator it)
Determine all the Coordinate dependencies of the object at 'it'.
Definition: evaluate.cc:1086
cadabra::evaluate::cleanup_components
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
cadabra::evaluate::call_sympy
bool call_sympy
Definition: evaluate.hh:109
cadabra::evaluate::handle_components
iterator handle_components(iterator it)
Definition: evaluate.cc:127
cadabra::evaluate::only_rhs
bool only_rhs
Definition: evaluate.hh:109