Cadabra
Computer algebra system for field theory problems
Loading...
Searching...
No Matches
NEvaluator.hh
Go to the documentation of this file.
1
2#pragma once
3
4#include "Storage.hh"
5#include "NTensor.hh"
6#include "Compare.hh"
7#include <functional>
8
9namespace cadabra {
10
28
29 class NEvaluator {
30 public:
31 NEvaluator();
32 NEvaluator(Ex::iterator);
33
39 std::map<Ex::iterator, NTensor, Ex::iterator_base_less> subtree_values;
40
48 std::map<Ex::iterator, Ex::iterator, Ex::iterator_base_less> subtree_equalities;
49
54 public:
57 std::vector<Ex::iterator> locations;
58 };
59 std::vector<VariableValues> variable_values;
60 std::map<Ex, size_t, tree_exact_less_no_wildcards_obj> variable_values_locs;
61
63 void set_function(Ex::iterator);
64
67 void set_variable(const Ex&, const NTensor& val);
68
72 typedef std::function<std::complex<double>(const Ex&)> lookup_function_t;
74
79
81
83
84 private:
87
88 // The shape of the tensor that we will produce.
89 std::vector<size_t> fullshape;
90 };
91
92};
Definition Storage.hh:170
The expression will get evaluated for a range of values for each unknown sub-expression (variable).
Definition NEvaluator.hh:53
Ex variable
Definition NEvaluator.hh:55
std::vector< Ex::iterator > locations
Definition NEvaluator.hh:57
NTensor values
Definition NEvaluator.hh:56
Functionality to numerically evaluate a scalar expression, give the values of its building blocks.
Definition NEvaluator.hh:29
std::vector< VariableValues > variable_values
Definition NEvaluator.hh:59
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.
Definition NEvaluator.hh:39
Ex ex
Definition NEvaluator.hh:85
lookup_function_t lookup_function
Definition NEvaluator.hh:86
void find_variable_locations()
PRIVATE:
Definition NEvaluator.cc:326
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 anoth...
Definition NEvaluator.hh:48
std::map< Ex, size_t, tree_exact_less_no_wildcards_obj > variable_values_locs
Definition NEvaluator.hh:60
void set_lookup_function(lookup_function_t)
Definition NEvaluator.cc:36
NTensor evaluate()
Evaluate the expression, using the variable values set in set_variable.
Definition NEvaluator.cc:41
std::function< std::complex< double >(const Ex &)> lookup_function_t
Set an external function which will be used by evaluate to lookup values of objects as a last resort,...
Definition NEvaluator.hh:72
NEvaluator()
Definition NEvaluator.cc:22
void set_function(Ex::iterator)
Set function to evaluate. Can also be passed in the constructor.
Definition NEvaluator.cc:31
void set_variable(const Ex &, const NTensor &val)
Set the range of values which we want to insert into the indicated variable.
Definition NEvaluator.cc:306
std::vector< size_t > fullshape
Definition NEvaluator.hh:89
Definition NTensor.hh:15
Functions to handle the exchange properties of two or more symbols in a product.
Definition Adjform.cc:83
void set(rset_t::iterator &num, multiplier_t fac)
Definition Storage.cc:1179