Reference documentation for deal.II version 9.3.3
|
#include <deal.II/differentiation/sd/symengine_optimizer.h>
Public Member Functions | |
BatchOptimizer () | |
BatchOptimizer (const enum OptimizerType &optimization_method, const enum OptimizationFlags &optimization_flags=OptimizationFlags::optimize_all) | |
BatchOptimizer (const BatchOptimizer &other) | |
BatchOptimizer (BatchOptimizer &&)=default | |
~BatchOptimizer ()=default | |
template<typename Stream > | |
void | print (Stream &stream, const bool print_cse=false) const |
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) |
Independent variables | |
void | register_symbols (const types::substitution_map &substitution_map) |
void | register_symbols (const SymEngine::map_basic_basic &substitution_map) |
void | register_symbols (const types::symbol_vector &symbols) |
void | register_symbols (const SymEngine::vec_basic &symbols) |
types::symbol_vector | get_independent_symbols () const |
std::size_t | n_independent_variables () const |
Dependent variables | |
void | register_function (const Expression &function) |
template<int rank, int dim> | |
void | register_function (const Tensor< rank, dim, Expression > &function_tensor) |
template<int rank, int dim> | |
void | register_function (const SymmetricTensor< rank, dim, Expression > &function_tensor) |
void | register_functions (const types::symbol_vector &functions) |
void | register_functions (const SymEngine::vec_basic &functions) |
template<typename T > | |
void | register_functions (const std::vector< T > &functions) |
template<typename T , typename... Args> | |
void | register_functions (const T &functions, const Args &... other_functions) |
const types::symbol_vector & | get_dependent_functions () const |
std::size_t | n_dependent_variables () const |
Optimization | |
void | set_optimization_method (const enum OptimizerType &optimization_method, const enum OptimizationFlags &optimization_flags=OptimizationFlags::optimize_all) |
enum OptimizerType | optimization_method () const |
enum OptimizationFlags | optimization_flags () const |
bool | use_symbolic_CSE () const |
void | optimize () |
bool | optimized () const |
Symbol substitution | |
void | substitute (const types::substitution_map &substitution_map) const |
void | substitute (const SymEngine::map_basic_basic &substitution_map) const |
void | substitute (const types::symbol_vector &symbols, const std::vector< ReturnType > &values) const |
void | substitute (const SymEngine::vec_basic &symbols, const std::vector< ReturnType > &values) const |
bool | values_substituted () const |
Evaluation / data extraction | |
using | map_dependent_expression_to_vector_entry_t = std::map< SD::Expression, std::size_t, SD::types::internal::ExpressionKeyLess > |
enum OptimizerType | method |
enum OptimizationFlags | flags |
types::substitution_map | independent_variables_symbols |
types::symbol_vector | dependent_variables_functions |
std::vector< ReturnType > | dependent_variables_output |
map_dependent_expression_to_vector_entry_t | map_dep_expr_vec_entry |
std::unique_ptr< SymEngine::Visitor > | optimizer |
bool | ready_for_value_extraction |
bool | has_been_serialized |
const std::vector< ReturnType > & | evaluate () const |
ReturnType | evaluate (const Expression &func) const |
std::vector< ReturnType > | evaluate (const std::vector< Expression > &funcs) const |
template<int rank, int dim> | |
Tensor< rank, dim, ReturnType > | evaluate (const Tensor< rank, dim, Expression > &funcs) const |
template<int rank, int dim> | |
SymmetricTensor< rank, dim, ReturnType > | evaluate (const SymmetricTensor< rank, dim, Expression > &funcs) const |
ReturnType | extract (const Expression &func, const std::vector< ReturnType > &cached_evaluation) const |
std::vector< ReturnType > | extract (const std::vector< Expression > &funcs, const std::vector< ReturnType > &cached_evaluation) const |
template<int rank, int dim> | |
Tensor< rank, dim, ReturnType > | extract (const Tensor< rank, dim, Expression > &funcs, const std::vector< ReturnType > &cached_evaluation) const |
template<int rank, int dim> | |
SymmetricTensor< rank, dim, ReturnType > | extract (const SymmetricTensor< rank, dim, Expression > &funcs, const std::vector< ReturnType > &cached_evaluation) const |
bool | is_valid_nonunique_dependent_variable (const SD::Expression &function) const |
bool | is_valid_nonunique_dependent_variable (const SymEngine::RCP< const SymEngine::Basic > &function) const |
void | register_scalar_function (const SD::Expression &function) |
void | register_vector_functions (const types::symbol_vector &functions) |
void | create_optimizer (std::unique_ptr< SymEngine::Visitor > &optimizer) |
void | substitute (const std::vector< ReturnType > &substitution_values) const |
A class that facilitates the optimization of symbol expressions.
This expression will be optimized by this class; that is to say that the code path taken to substitute the set of (independent) symbols into a collection of (dependent) symbolic functions will be optimized using a chosen approach.
This snippet of pseudo-code describes the general usage of this class:
Since the call to optimize() may be quite costly, there are a few "best practices" that can be adopted in order to mitigate this cost as much as possible:
ReturnType | The number type that is to be returned after value substitution and evaluation. Floating point and complex numbers are currently supported. |
ReturnType
and optimization method are selected, then an error will be thrown at run time. Definition at line 1444 of file symengine_optimizer.h.