8#include <kernel/analytic/function.hpp> 
   36    template<
typename DT_, 
typename IT_, 
typename Function_>
 
   41        static_assert(std::is_same<typename Function_::ImageType, Analytic::Image::Scalar>::value,
 
   42        "AnalyticFunctionOperator is implemented for scalar functions only");
 
   53        static constexpr bool can_hess = FunctionType::can_hess;
 
   60        typedef typename Function_::template Evaluator<FuncEvalTraits> 
EvalType;
 
   65        static constexpr int dim = PointType::n;
 
  118          return "AnalyticFunctionOperator";
 
  209        template<
typename FilterType_>
 
  271          for(
int i(1); i < mat_out.m; ++i)
 
  273            for(
int j(0); j < i; ++j)
 
  275              mat_out(i,j) = DT_(0);
 
  276              mat_out(j,i) = DT_(0);
 
Blocked Dense data vector class template.
Wrapper class defining an operator based on a scalar AnalyticFunction.
PointType _my_state
The current point, the function and its gradient/hessian are evaluated here.
Function_ & _function
The Analytic::Function.
EvalType::HessianType _my_hess
Temporary variable to save the current hessian or other matrices.
Index _num_func_evals
Counter for number of function evaluations.
EvalType _func_eval
_function's Evaluator
void reset_num_evals()
Resets all evaluation counts.
void apply_hess(VectorTypeL &vec_out, const VectorTypeR &vec_in)
Applies the Hessian of the operator at the current state to a vector.
LAFEM::DenseVectorBlocked< DT_, IT_, dim > VectorTypeL
Output vector for the operator's gradient.
DT_ DataType
Check if Function_ is scalar.
EvalType::HessianType HessianType
Output matrix for the operator's hessian.
Analytic::EvalTraits< DT_, Function_ > FuncEvalTraits
Class that knows what Function_ wants as input parameters for its evaluator etc.
AnalyticFunctionOperator(Function_ &func)
The one and only sensible constructor.
Index rows()
The number of output variables of the operator's gradient.
EvalType::GradientType _my_grad
Temporary variable to save the current gradient or other vectors.
Index get_num_grad_evals() const
Index _num_grad_evals
Counter for number of gradient evaluations.
void eval_fval_grad(typename EvalType::ValueType &fval, GradientType &grad)
Evaluates the gradient of the operator at the current state.
Index columns()
The number of input variables for the operator and its gradient.
static constexpr int dim
Dimension each variable is from.
static constexpr bool can_hess
Can the operator compute its full Hessian?
EvalType::PointType PointType
Input type for Function_.
void compute_hess(HessianType &mat_out)
Evaluates the Hessian of the operator at the current state.
LAFEM::DenseVectorBlocked< DT_, IT_, dim > VectorTypeR
Input vector for the operator and its gradient.
void prepare(const VectorTypeR &vec_state, FilterType_ filter)
Prepares the operator for evaluation by setting the current state.
Function_::template Evaluator< FuncEvalTraits > EvalType
Type of Function_'s evaluator.
void compute_approx_hess(HessianType &mat_out)
Evaluates the Hessian of the operator at the current state.
Index get_num_hess_evals() const
IT_ IndexType
Integer type.
static constexpr bool can_diag_hess
Can the operator compute the diagonal of its Hessian?
VectorTypeR create_vector_r() const
Creates an empty R-vector of appropriate size.
Function_ FunctionType
The type of the underlying analytic function.
VectorTypeL create_vector_l() const
Creates an empty L-vector of appropriate size.
VectorTypeR GradientType
Output vector for the operator's gradient.
Index get_num_func_evals() const
Index _num_hess_evals
Counter for number of hessian evaluations.
String class implementation.
@ grad
specifies whether the space should supply basis function gradients
std::uint64_t Index
Index data type.