Cadabra
Computer algebra system for field theory problems
Classes | Public Member Functions | Public Attributes | Private Attributes | List of all members
cadabra::NEvaluator Class Reference

Description

Functionality to numerically evaluate a scalar expression, give the values of its building blocks.

The input is a map which relates subtrees in the expression to numerical values. The evaluate function will then do a post-order iteration over the tree, collecting and combining the values thus obtained.

Currently needs the leaf nodes to have an entry in the subtree_values map; may be extended later to cover values of non-elementary subtrees.

If the input variables are 'a' NTensors, then at any stage...

#include <NEvaluator.hh>

Classes

class  VariableValues
 The expression will get evaluated for a range of values for each unknown sub-expression (variable). More...
 

Public Member Functions

 NEvaluator (const Ex &)
 
void set_variable (const Ex &, const NTensor &val)
 Set the range of values which we want to insert into the indicated variable. More...
 
NTensor evaluate ()
 Evaluate the expression, using the variable values set in set_variable. More...
 
void find_variable_locations ()
 PRIVATE: More...
 

Public Attributes

std::map< Ex::iterator, NTensor, Ex::iterator_base_less > subtree_values
 If we know the value of a subtree explicitly as a number, it is stored in this map. More...
 
std::map< Ex::iterator, Ex::iterator, Ex::iterator_base_less > subtree_equalities
 If we know the value of a subtree is equal to another subtree (either in the same expression or another one), it is stored in the map below. More...
 
std::vector< VariableValuesvariable_values
 

Private Attributes

const Exex
 

Constructor & Destructor Documentation

◆ NEvaluator()

NEvaluator::NEvaluator ( const Ex ex_)

Member Function Documentation

◆ evaluate()

NTensor NEvaluator::evaluate ( )

Evaluate the expression, using the variable values set in set_variable.

◆ find_variable_locations()

void NEvaluator::find_variable_locations ( )

PRIVATE:

◆ set_variable()

void NEvaluator::set_variable ( const Ex var,
const NTensor val 
)

Set the range of values which we want to insert into the indicated variable.

Fills the map above.

Member Data Documentation

◆ ex

const Ex& cadabra::NEvaluator::ex
private

◆ subtree_equalities

std::map<Ex::iterator, Ex::iterator, Ex::iterator_base_less> cadabra::NEvaluator::subtree_equalities

If we know the value of a subtree is equal to another subtree (either in the same expression or another one), it is stored in the map below.

This then still needs a lookup in the subtree_values map.

◆ subtree_values

std::map<Ex::iterator, NTensor, Ex::iterator_base_less> cadabra::NEvaluator::subtree_values

If we know the value of a subtree explicitly as a number, it is stored in this map.

These are computed nodes.

◆ variable_values

std::vector<VariableValues> cadabra::NEvaluator::variable_values

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