![]() |
Reference documentation for deal.II version 9.6.0
|
Classes | |
class | CSEDictionaryVisitor |
struct | DictionaryOptimizer |
class | DictionarySubstitutionVisitor |
struct | LambdaOptimizer |
struct | OptimizerHelper |
Functions | |
bool | use_symbolic_CSE (const enum OptimizationFlags &flags) |
int | get_LLVM_optimization_level (const enum OptimizationFlags &flags) |
template<typename NumberType , int rank, int dim, template< int, int, typename > class TensorType> | |
TensorType< rank, dim, NumberType > | tensor_evaluate_optimized (const TensorType< rank, dim, Expression > &symbol_tensor, const std::vector< NumberType > &cached_evaluation, const BatchOptimizer< NumberType > &optimizer) |
template<typename NumberType , int dim> | |
SymmetricTensor< 4, dim, NumberType > | tensor_evaluate_optimized (const SymmetricTensor< 4, dim, Expression > &symbol_tensor, const std::vector< NumberType > &cached_evaluation, const BatchOptimizer< NumberType > &optimizer) |
template<typename NumberType , typename T > | |
void | register_functions (BatchOptimizer< NumberType > &optimizer, const T &function) |
template<typename NumberType , typename T > | |
void | register_functions (BatchOptimizer< NumberType > &optimizer, const std::vector< T > &functions) |
template<typename NumberType , typename T , typename... Args> | |
void | register_functions (BatchOptimizer< NumberType > &optimizer, const T &function, const Args &...other_functions) |
template<int rank, int dim, template< int, int, typename > class TensorType> | |
types::symbol_vector | unroll_to_expression_vector (const TensorType< rank, dim, Expression > &symbol_tensor) |
template<int dim> | |
types::symbol_vector | unroll_to_expression_vector (const SymmetricTensor< 4, dim, Expression > &symbol_tensor) |
bool | is_valid_substitution_symbol (const SymEngine::Basic &entry) |
void | set_value_in_symbol_map (types::substitution_map &substitution_map, const SymEngine::RCP< const SymEngine::Basic > &symbol, const SymEngine::RCP< const SymEngine::Basic > &value) |
template<bool ignore_invalid_symbols = false> | |
void | add_to_substitution_map (types::substitution_map &substitution_map, const SymEngine::RCP< const SymEngine::Basic > &symbol, const SymEngine::RCP< const SymEngine::Basic > &value) |
This namespace defines the classes and functions that help provide a structured interface to symbolic numbers and operations.
|
inline |
A utility function that checks whether or not CSE has been selected as an optimization flag.
Definition at line 234 of file symengine_optimizer.h.
|
inline |
A utility function that returns the optimization level that is to be employed when the LLVM optimizer is invoked.
Definition at line 244 of file symengine_optimizer.h.
TensorType< rank, dim, NumberType > Differentiation::SD::internal::tensor_evaluate_optimized | ( | const TensorType< rank, dim, Expression > & | symbol_tensor, |
const std::vector< NumberType > & | cached_evaluation, | ||
const BatchOptimizer< NumberType > & | optimizer ) |
A convenience function that returns the numeric equivalent of an input symbol_tensor
, computed through the optimizer
.
NumberType | The number type that is returned as a result of operations performed by the optimizer. |
rank | The rank of the output tensor. |
dim | The dimension of the output tensor. |
TensorType | The type of tensor to be evaluated and returned (i.e. Tensor or SymmetricTensor). |
[in] | symbol_tensor | The symbolic tensor that is to be evaluated. |
[in] | cached_evaluation | A vector that stores the numerical values of all dependent variables referenced by the optimizer . This vector is, most typically, first attained by a call to the BatchOptimizer::evaluate() variant that takes no arguments. |
[in] | optimizer | The optimizer that can evaluate the input symbol_tensor . |
symbol_tensor
evaluates to. Definition at line 1130 of file symengine_optimizer.h.
SymmetricTensor< 4, dim, NumberType > Differentiation::SD::internal::tensor_evaluate_optimized | ( | const SymmetricTensor< 4, dim, Expression > & | symbol_tensor, |
const std::vector< NumberType > & | cached_evaluation, | ||
const BatchOptimizer< NumberType > & | optimizer ) |
A convenience function that returns the numeric equivalent of an input symbol_tensor
, computed through the optimizer
. This is a specialization for rank-4 symmetric tensors.
NumberType | The number type that is returned as a result of operations performed by the optimizer. |
rank | The rank of the output tensor. |
dim | The dimension of the output tensor. |
TensorType | The type of tensor to be evaluated and returned (i.e. Tensor or SymmetricTensor). |
[in] | symbol_tensor | The symbolic tensor that is to be evaluated. |
[in] | cached_evaluation | A vector that stores the numerical values of all dependent variables referenced by the optimizer . This vector is, most typically, first attained by a call to the BatchOptimizer::evaluate() variant that takes no arguments. |
[in] | optimizer | The optimizer that can evaluate the input symbol_tensor . |
symbol_tensor
evaluates to. Definition at line 1171 of file symengine_optimizer.h.
void Differentiation::SD::internal::register_functions | ( | BatchOptimizer< NumberType > & | optimizer, |
const T & | function ) |
A helper function to register a single function
with the optimizer
.
NumberType | The number type that is returned as a result of operations performed by the optimizer. |
T | A compatible type that may be used to represent a single dependent variable. This includes scalar Expressions, Tensors of Expressions and SymmetricTensors of Expressions. |
optimizer | The instance of the BatchOptimizer to register the function with. |
function | A symbolic expression (scalar or tensor) that represents a dependent variable. |
Definition at line 1212 of file symengine_optimizer.h.
void Differentiation::SD::internal::register_functions | ( | BatchOptimizer< NumberType > & | optimizer, |
const std::vector< T > & | functions ) |
A helper function to register a vector of functions
with the optimizer
.
NumberType | The number type that is returned as a result of operations performed by the optimizer. |
T | A compatible type that may be used to represent a single dependent variable. This includes scalar Expressions, Tensors of Expressions and SymmetricTensors of Expressions. |
optimizer | The instance of the BatchOptimizer to register the function with. |
functions | A vector of symbolic expressions (scalar or tensor) that each represent a dependent variable. |
Definition at line 1238 of file symengine_optimizer.h.
void Differentiation::SD::internal::register_functions | ( | BatchOptimizer< NumberType > & | optimizer, |
const T & | function, | ||
const Args &... | other_functions ) |
A helper function to register the symbolic dependent variables collectively given by function
and other_functions
with the optimizer
.
NumberType | The number type that is returned as a result of operations performed by the optimizer. |
T | A compatible type that may be used to represent a single dependent variable. This includes scalar Expressions, Tensors of Expressions and SymmetricTensors of Expressions. |
Args | The parameter pack that collects all other types of dependent variables to be registered. |
optimizer | The instance of the BatchOptimizer to register the function with. |
function | A valid symbolic expression (or collection of symbolic expression) that represents one (or more) dependent variable. |
other_functions | One or more other valid symbolic expression(s) that represent dependent variable(s). |
Definition at line 1267 of file symengine_optimizer.h.
types::symbol_vector Differentiation::SD::internal::unroll_to_expression_vector | ( | const TensorType< rank, dim, Expression > & | symbol_tensor | ) |
A utility function that unrolls the input symbol_tensor
into a vector of Expressions.
rank | The rank of the input tensor. |
dim | The dimension of the input tensor. |
TensorType | The type of tensor to be evaluated and returned (i.e. Tensor or SymmetricTensor). |
symbol_tensor |
Definition at line 1292 of file symengine_optimizer.h.
types::symbol_vector Differentiation::SD::internal::unroll_to_expression_vector | ( | const SymmetricTensor< 4, dim, Expression > & | symbol_tensor | ) |
A utility function that unrolls the input symbol_tensor
into a vector of Expressions. This is a specialization for rank-4 symmetric tensors.
dim | The dimension of the input tensor. |
symbol_tensor |
Definition at line 1319 of file symengine_optimizer.h.
bool Differentiation::SD::internal::is_valid_substitution_symbol | ( | const SymEngine::Basic & | entry | ) |
Return whether or not an entry
is a valid symbol that we can expect to perform substitution on.
void Differentiation::SD::internal::set_value_in_symbol_map | ( | types::substitution_map & | substitution_map, |
const SymEngine::RCP< const SymEngine::Basic > & | symbol, | ||
const SymEngine::RCP< const SymEngine::Basic > & | value ) |
A convenience function to set the value
associated with the symbol
in the substitution_map
.
Using this function ensures that the symbol
is one that is valid specifically for the purpose of symbolic substitution. It must therefore represent a symbol or symbolic derivative, otherwise an error will be thrown.
void Differentiation::SD::internal::add_to_substitution_map | ( | types::substitution_map & | substitution_map, |
const SymEngine::RCP< const SymEngine::Basic > & | symbol, | ||
const SymEngine::RCP< const SymEngine::Basic > & | value ) |
A convenience function to add an entry to the substitution_map
. The new entry will have the key given by symbol
with its paired value
. Such maps are required to perform substitution of symbolic expressions, where all entries given as keys in the map are substituted by their value counterparts.
There are cases where it is convenient to simply ignore the fact that we may be trying to add invalid symbols. For example, one may wish to add a tensor where only some entries are symbols and the others are zero'd. In this case we ensure that the user knows what they're doing by forcing them to override this safety mechanism with a template parameter. These types of functions are typically called in a manner indicating that the user knows exactly what they're passing into it.
ignore_invalid_symbols | A template parameter that enforces whether or not the symbol has to be a valid one or not. In the overwhelming majority of cases, the default value of false should be selected, with the result that an exception will be thrown if the input symbolic is, in fact, not a symbolic value or expression. |