Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
evaluate.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "Compare.hh"
5 
6 
11 
75 #include "Algorithm.hh"
76 #include "properties/Indices.hh"
77 
78 namespace cadabra {
79 
80 class evaluate : public Algorithm {
81  public:
82  evaluate(const Kernel&, Ex&, const Ex& component_values, bool rhs=false, bool simplify=true);
83 
84  virtual bool can_apply(iterator) override;
85  virtual result_t apply(iterator&) override;
86 
90  void merge_components(iterator it1, iterator it2);
91 
92  private:
93  const Ex& components;
95 
96  bool is_component(iterator it) const;
97 
103 
107 
108  iterator handle_factor(sibling_iterator sib, const index_map_t& full_ind_free);
109 
113  iterator dense_factor(iterator sib, const index_map_t& ind_free, const index_map_t& ind_dummy);
114 
118 
121  void cleanup_components(iterator it1);
122 
126 
129 
132  std::set<Ex, tree_exact_less_obj> dependencies(iterator it);
133 };
134 
135 }
iterator handle_sum(iterator it)
Definition: evaluate.cc:117
Base class for all algorithms, containing generic routines and in particular the logic for index clas...
Definition: Algorithm.hh:58
Ex rhs(const Ex &ex)
Definition: PythonCdb.cc:219
iterator handle_components(iterator it)
Definition: evaluate.cc:102
Basic storage class for symbolic mathemematical expressions.
Definition: Storage.hh:130
std::set< Ex, tree_exact_less_obj > dependencies(iterator it)
Determine all the Coordinate dependencies of the object at 'it'.
Definition: evaluate.cc:891
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:419
bool call_sympy
Definition: evaluate.hh:94
Definition: evaluate.hh:80
void simplify_components(iterator)
Simplify all components of a 'components' node by running sympy's simplify on them.
Definition: evaluate.cc:855
const Ex & components
Definition: evaluate.hh:93
bool is_component(iterator it) const
Definition: evaluate.cc:90
iterator wrap_scalar_in_components_node(iterator sib)
Wrap a non-component scalar node in a 'components' node.
Definition: evaluate.cc:938
Ex::iterator iterator
Definition: Algorithm.hh:69
Ex::sibling_iterator sibling_iterator
Definition: Algorithm.hh:71
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:307
virtual bool can_apply(iterator) override
Definition: evaluate.cc:25
iterator handle_derivative(iterator it)
Definition: evaluate.cc:515
iterator handle_epsilon(iterator it)
Definition: evaluate.cc:812
iterator handle_prod(iterator it)
Definition: evaluate.cc:948
iterator handle_factor(sibling_iterator sib, const index_map_t &full_ind_free)
Replace a single factor with a 'components' ...
Definition: evaluate.cc:174
void cleanup_components(iterator it1)
Cleanup all components in a 'components' node; that is, call the cleanup_dispatch function on them...
Definition: evaluate.cc:501
virtual result_t apply(iterator &) override
Definition: evaluate.cc:30
Definition: Kernel.hh:15
void merge_component_children(iterator it)
Merge entries in a single 'components' node when they are for the.
Definition: evaluate.cc:375
result_t
Keeping track of what algorithms have done to this expression.
Definition: Storage.hh:149
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: Algorithm.hh:138
bool only_rhs
Definition: evaluate.hh:94
evaluate(const Kernel &, Ex &, const Ex &component_values, bool rhs=false, bool simplify=true)
Definition: evaluate.cc:20