Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cadabra::evaluate Class Reference

#include <evaluate.hh>

Inheritance diagram for cadabra::evaluate:
cadabra::Algorithm

Public Member Functions

 evaluate (const Kernel &, Ex &, const Ex &component_values, bool rhs=false, bool simplify=true)
 
virtual bool can_apply (iterator) override
 
virtual result_t apply (iterator &) override
 
void merge_components (iterator it1, iterator it2)
 Merge the information in two 'components' nodes at the given iterators, moving all out of the second one into the first one. More...
 
- Public Member Functions inherited from cadabra::Algorithm
 Algorithm (const Kernel &, Ex &)
 Initialise the algorithm with a reference to the expression tree, but do not yet do anything with this tree. More...
 
virtual ~Algorithm ()
 
void set_progress_monitor (ProgressMonitor *)
 Provide the algorithm with a ProgressMonitor object on which to register (nested) progress information, to be reported out-of-band to a client. More...
 
result_t apply_generic (bool deep=true, bool repeat=false, unsigned int depth=0)
 The main entry points for running algorithms, which traverse the tree post-order ('child before parent'). More...
 
result_t apply_generic (iterator &, bool deep, bool repeat, unsigned int depth)
 
result_t apply_pre_order (bool repeat=false)
 Apply algorithm with alternative traversal: starting from the top node, traverse the tree pre-order ('parent before child') and once the algorithm acts at a given node, do not traverse the subtree below anymore. More...
 
bool check_consistency (iterator) const
 Given an expression top node, check index consistency. More...
 
bool check_index_consistency (iterator) const
 
bool check_degree_consistency (iterator) const
 Given an expression top node, check differential form degree consistency. More...
 
void report_progress (const std::string &, int todo, int done, int count=2)
 
index_iterator begin_index (iterator it) const
 
index_iterator end_index (iterator it) const
 
unsigned int number_of_indices (iterator it)
 
bool rename_replacement_dummies (iterator, bool still_inside_algo=false)
 

Private Member Functions

bool is_component (iterator it) const
 
iterator handle_components (iterator it)
 
iterator handle_sum (iterator it)
 
iterator handle_prod (iterator it)
 
iterator handle_derivative (iterator it)
 
iterator handle_epsilon (iterator it)
 
iterator handle_factor (sibling_iterator sib, const index_map_t &full_ind_free)
 Replace a single factor with a 'components' ... More...
 
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. More...
 
void merge_component_children (iterator it)
 Merge entries in a single 'components' node when they are for the. More...
 
void cleanup_components (iterator it1)
 Cleanup all components in a 'components' node; that is, call the cleanup_dispatch function on them. More...
 
void simplify_components (iterator)
 Simplify all components of a 'components' node by running sympy's simplify on them. More...
 
iterator wrap_scalar_in_components_node (iterator sib)
 Wrap a non-component scalar node in a 'components' node. More...
 
std::set< Ex, tree_exact_less_objdependencies (iterator it)
 Determine all the Coordinate dependencies of the object at 'it'. More...
 

Private Attributes

const Excomponents
 
bool only_rhs
 
bool call_sympy
 

Additional Inherited Members

- Public Types inherited from cadabra::Algorithm
typedef Ex::iterator iterator
 
typedef Ex::post_order_iterator post_order_iterator
 
typedef Ex::sibling_iterator sibling_iterator
 
typedef Ex::result_t result_t
 
typedef 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. More...
 
typedef std::map< Ex::iterator,
int, Ex::iterator_base_less > 
index_position_map_t
 A map from the position of each index to the sequential index. More...
 
- Static Public Member Functions inherited from cadabra::Algorithm
static unsigned int number_of_indices (const Properties &, iterator it)
 
static unsigned int number_of_direct_indices (iterator it)
 
- Public Attributes inherited from cadabra::Algorithm
bool interrupted
 
unsigned int number_of_calls
 
unsigned int number_of_modifications
 
bool suppress_normal_output
 
bool discard_command_node
 
Stopwatch index_sw
 
Stopwatch get_dummy_sw
 
Stopwatch report_progress_stopwatch
 
- Protected Types inherited from cadabra::Algorithm
typedef std::pair
< sibling_iterator,
sibling_iterator
range_t
 Finding objects in sets. More...
 
typedef std::vector< range_trange_vector_t
 
- Protected Member Functions inherited from cadabra::Algorithm
int index_parity (iterator) const
 
bool contains (sibling_iterator from, sibling_iterator to, sibling_iterator arg)
 
void find_argument_lists (range_vector_t &, bool only_comma_lists=true) const
 
template<class Iter >
range_vector_t::iterator find_arg_superset (range_vector_t &, Iter st, Iter nd)
 
range_vector_t::iterator find_arg_superset (range_vector_t &, sibling_iterator it)
 
unsigned int locate_single_object (Ex::iterator obj_to_find, Ex::iterator st, Ex::iterator nd, std::vector< unsigned int > &store)
 
bool locate_object_set (const Ex &objs, Ex::iterator st, Ex::iterator nd, std::vector< unsigned int > &store)
 
bool is_termlike (iterator)
 Determine structure (version-2) More...
 
bool is_factorlike (iterator)
 
bool is_single_term (iterator)
 Take a single non-product node in a sum and wrap it in a product node, so it can be handled on the same footing as a proper product. More...
 
bool is_nonprod_factor_in_prod (iterator)
 
bool prod_wrap_single_term (iterator &)
 
bool prod_unwrap_single_term (iterator &)
 
void force_prod_wrap (iterator &)
 Wrap a term in a product, irrespective of its parent (it usually makes more sense to call the safer prod_wrap_single_term above). More...
 
bool separated_by_derivative (iterator, iterator, iterator check_dependence) const
 Figure out whether two objects (commonly indices) are separated by a derivative operator, as in

\[ \partial_{a}{A_{b}} C^{b} \]

. More...

 
void pushup_multiplier (iterator)
 
template<class BinaryPredicate >
unsigned int intersection_number (sibling_iterator, sibling_iterator, sibling_iterator, sibling_iterator, BinaryPredicate) const
 Determine the number of elements in the first range which also occur in the second range. More...
 
void node_zero (iterator)
 
void node_one (iterator)
 
void node_integer (iterator, int)
 
void fill_index_position_map (iterator, const index_map_t &, index_position_map_t &) const
 Index manipulation and classification. More...
 
void fill_map (index_map_t &, sibling_iterator, sibling_iterator) const
 
void print_classify_indices (std::ostream &, iterator) const
 
void determine_intersection (index_map_t &one, index_map_t &two, index_map_t &target, bool move_out=false) const
 
void classify_add_index (iterator it, index_map_t &ind_free, index_map_t &ind_dummy) const
 
void classify_indices_up (iterator, index_map_t &ind_free, index_map_t &ind_dummy) const
 
void classify_indices (iterator, index_map_t &ind_free, index_map_t &ind_dummy) const
 
int max_numbered_name_one (const std::string &nm, const index_map_t *one) const
 
int max_numbered_name (const std::string &, const index_map_t *m1, const index_map_t *m2=0, const index_map_t *m3=0, const index_map_t *m4=0, const index_map_t *m5=0) const
 
Ex get_dummy (const list_property *, const index_map_t *m1, const index_map_t *m2=0, const index_map_t *m3=0, const index_map_t *m4=0, const index_map_t *m5=0) const
 
Ex get_dummy (const list_property *, iterator) const
 
Ex get_dummy (const list_property *, iterator, iterator) const
 
bool index_in_set (Ex, const index_map_t *) const
 
index_map_t::iterator find_modulo_parent_rel (iterator it, index_map_t &imap) const
 Find an index in the set, not taking into account index position. More...
 
- Static Protected Member Functions inherited from cadabra::Algorithm
static bool less_without_numbers (nset_t::iterator, nset_t::iterator)
 
static bool equal_without_numbers (nset_t::iterator, nset_t::iterator)
 
static bool compare_ (const str_node &, const str_node &)
 
- Protected Attributes inherited from cadabra::Algorithm
const Kernelkernel
 
Extr
 
ProgressMonitorpm
 

Constructor & Destructor Documentation

evaluate::evaluate ( const Kernel k,
Ex tr,
const Ex component_values,
bool  rhs = false,
bool  simplify = true 
)

Member Function Documentation

Algorithm::result_t evaluate::apply ( iterator it)
overridevirtual

Implements cadabra::Algorithm.

bool evaluate::can_apply ( iterator  it)
overridevirtual

Implements cadabra::Algorithm.

void evaluate::cleanup_components ( iterator  it1)
private

Cleanup all components in a 'components' node; that is, call the cleanup_dispatch function on them.

Ex::iterator evaluate::dense_factor ( iterator  sib,
const index_map_t ind_free,
const index_map_t ind_dummy 
)
private

Expand a tensor factor into a components node with all components written out explicitly.

Used when there is no sparse rule matching this factor.

std::set< Ex, tree_exact_less_obj > evaluate::dependencies ( iterator  it)
private

Determine all the Coordinate dependencies of the object at 'it'.

For the time being this can only be a 'components' node.

Ex::iterator evaluate::handle_components ( iterator  it)
private
Ex::iterator evaluate::handle_derivative ( iterator  it)
private
Ex::iterator evaluate::handle_epsilon ( iterator  it)
private
Ex::iterator evaluate::handle_factor ( sibling_iterator  sib,
const index_map_t full_ind_free 
)
private

Replace a single factor with a 'components' ...

The full_ind_free argument can contain a list of indices in the order in which values should be stored in index value sets.

Ex::iterator evaluate::handle_prod ( iterator  it)
private
Ex::iterator evaluate::handle_sum ( iterator  it)
private
bool evaluate::is_component ( iterator  it) const
private
void evaluate::merge_component_children ( iterator  it)
private

Merge entries in a single 'components' node when they are for the.

same index value(s).

void evaluate::merge_components ( iterator  it1,
iterator  it2 
)

Merge the information in two 'components' nodes at the given iterators, moving all out of the second one into the first one.

void evaluate::simplify_components ( iterator  it)
private

Simplify all components of a 'components' node by running sympy's simplify on them.

Returns a replacement iterator to the top.

Algorithm::iterator evaluate::wrap_scalar_in_components_node ( iterator  sib)
private

Wrap a non-component scalar node in a 'components' node.

Member Data Documentation

bool cadabra::evaluate::call_sympy
private
const Ex& cadabra::evaluate::components
private
bool cadabra::evaluate::only_rhs
private

The documentation for this class was generated from the following files: