![]() |
Reference documentation for deal.II version 9.2.0
|
#include <deal.II/differentiation/sd/symengine_number_visitor_internal.h>
Public Member Functions | |
DictionarySubstitutionVisitor ()=default | |
virtual | ~DictionarySubstitutionVisitor () override=default |
void | init (const types::symbol_vector &independent_symbols, const Expression &dependent_function, const bool use_cse=false) |
void | init (const SymEngine::vec_basic &independent_symbols, const SymEngine::Basic &dependent_function, const bool use_cse=false) |
void | init (const types::symbol_vector &independent_symbols, const types::symbol_vector &dependent_functions, const bool use_cse=false) |
void | init (const SymEngine::vec_basic &independent_symbols, const SymEngine::vec_basic &dependent_functions, const bool use_cse=false) |
void | call (ReturnType *output_values, const ReturnType *substitution_values) |
ReturnType | call (const std::vector< ReturnType > &substitution_values) |
template<class Archive > | |
void | save (Archive &archive, const unsigned int version) const |
template<class Archive > | |
void | load (Archive &archive, const unsigned int version) |
template<class Archive > | |
void | serialize (Archive &archive, const unsigned int version) |
template<typename StreamType > | |
void | print (StreamType &stream, const bool print_independent_symbols=false, const bool print_dependent_functions=false, const bool print_cse_reductions=false) const |
Private Attributes | |
SD::types::symbol_vector | independent_symbols |
SD::types::symbol_vector | dependent_functions |
CSEDictionaryVisitor< ReturnType, ExpressionType > | cse |
A class to perform dictionary-based substitution as if it were an optimizer of the "lambda" or "LLVM" variety.
This class is only really useful to assist in the easy switching between different optimizers and, more importantly, for integrating CSE into a dictionary substitution scheme. It is therefore only intended to be created and used by a BatchOptimizer.
Definition at line 270 of file symengine_number_visitor_internal.h.
|
default |
|
overridevirtualdefault |
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::init | ( | const types::symbol_vector & | independent_symbols, |
const Expression & | dependent_function, | ||
const bool | use_cse = false |
||
) |
Initialization, and registration of the independent and dependent variables.
This variation of the initialization function registers a single dependent expression. If the use_cse
is set to true
, then common subexpression elimination is also performed at the time of initialization.
independent_symbols | A vector of symbols that represent the independent variables that are arguments to the dependent_function . |
dependent_function | A single symbolic expression that represents a dependent variable. |
use_cse | A flag to indicate whether or not to use common subexpression elimination. |
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::init | ( | const SymEngine::vec_basic & | independent_symbols, |
const SymEngine::Basic & | dependent_function, | ||
const bool | use_cse = false |
||
) |
Initialization, and registration of the independent and dependent variables.
This function performs the same action as the other init() function, described above, except that it works with native SymEngine data types. The independent_symbols
are represented by a vector of SymEngine::RCP<const SymEngine::Basic>
, and the dependent_function
is of type SymEngine::RCP<const SymEngine::Basic>
.
independent_symbols | A vector of symbols that represent the independent variables that are arguments to the dependent_function . |
dependent_function | A single symbolic expression that represents a dependent variable. |
use_cse | A flag to indicate whether or not to use common subexpression elimination. |
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::init | ( | const types::symbol_vector & | independent_symbols, |
const types::symbol_vector & | dependent_functions, | ||
const bool | use_cse = false |
||
) |
Initialization, and registration of the independent and dependent variables.
This variation of the initialization function registers a vector of dependent expressions. If the use_cse
is set to true
, then common subexpression elimination is also performed at the time of initialization.
independent_symbols | A vector of symbols that represent the independent variables that are arguments to the dependent_functions . |
dependent_functions | A vector of symbolic expressions that represent the dependent variables. |
use_cse | A flag to indicate whether or not to use common subexpression elimination. |
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::init | ( | const SymEngine::vec_basic & | independent_symbols, |
const SymEngine::vec_basic & | dependent_functions, | ||
const bool | use_cse = false |
||
) |
Initialization, and registration of the independent and dependent variables.
This function performs the same action as the other init() function, described above, except that it works with native SymEngine data types. Both the independent_symbols
and dependent_functions
are represented by a vector of SymEngine::RCP<const SymEngine::Basic>
.
independent_symbols | A vector of symbols that represent the independent variables that are arguments to the dependent_functions . |
dependent_functions | A vector of symbolic expressions that represent the dependent variables. |
use_cse | A flag to indicate whether or not to use common subexpression elimination. |
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::call | ( | ReturnType * | output_values, |
const ReturnType * | substitution_values | ||
) |
Evaluate the dependent functions that were registered at initializtion time.
The output_values
are the numerical result of substituting each of the substitution_values
for their corresponding entry of the pre-registered independent variables.
[out] | output_values | A pointer to the first element in an array of type ReturnType . After this call, the underlying array will hold the numerical result of substituting the substitution_values into the pre-registered dependent functions. |
[in] | substitution_values | A pointer to the first element in an array of type ReturnType . Each entry in this array stores the numerical value that an independent variable is to take for the purpose of value substitution. |
output_values
and substitution_values
arrays be correctly dimensioned, as there is no range checking performed on these data structures. The output_values
array should have the same number of elements as the dependent functions first passed to this class in the call to init(). Similarly, the substitution_values
array should have the same number of elements as the there were independent variables that were registered at the time of initialization.substitution_values
. This is not checked within this function, so it is up to the user to ensure that the relationships between the independent variables and their numerical value be correctly set up and maintained. ReturnType Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::call | ( | const std::vector< ReturnType > & | substitution_values | ) |
Evaluate the dependent function that were registered at initializtion time.
The purpose of this function is the same as the other call() functions, but
substitution_values | A vector that stores the numerical values that each independent variable that was registered with the class instance is to take for the purpose of value substitution. |
substitution_values
. void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::save | ( | Archive & | archive, |
const unsigned int | version | ||
) | const |
Write the data of this object to a stream for the purpose of serialization.
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::load | ( | Archive & | archive, |
const unsigned int | version | ||
) |
Read the data for this object from a stream for the purpose of serialization.
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::serialize | ( | Archive & | archive, |
const unsigned int | version | ||
) |
Write and read the data of this object from a stream for the purpose of serialization.
void Differentiation::SD::internal::DictionarySubstitutionVisitor< ReturnType, ExpressionType >::print | ( | StreamType & | stream, |
const bool | print_independent_symbols = false , |
||
const bool | print_dependent_functions = false , |
||
const bool | print_cse_reductions = false |
||
) | const |
Print some information on state of the internal data structures stored in the class.
Stream | The type for the output stream. |
stream | The output stream to print to. |
print_independent_symbols | A flag to indicate if the independent variables should be outputted to the stream . |
print_dependent_functions | A flag to indicate if the dependent expressions should be outputted to the stream . |
print_cse_reductions | A flag to indicate whether or not all common subexpressions should be printed to the stream . |
|
private |
A vector of symbols that represent the independent variables.
Definition at line 568 of file symengine_number_visitor_internal.h.
|
private |
A vector of expressions that represent dependent functions.
Definition at line 573 of file symengine_number_visitor_internal.h.
|
private |
A data structure that may be used to invoke common subexpression elimination on the dependent functions, with the aim to decrease the time taken to evaluate them.
Definition at line 580 of file symengine_number_visitor_internal.h.