MiniTensor Version of the Day
Loading...
Searching...
No Matches
minitensor::SquareRoot< S, M > Class Template Reference

#include <MiniTensor_TestFunctions.h>

Inheritance diagram for minitensor::SquareRoot< S, M >:
minitensor::Function_Base< SquareRoot< S, 1 >, S, 1 >

Public Types

using Base = Function_Base<SquareRoot<S, M>, S, M>

Public Member Functions

 SquareRoot (S const c)
template<typename T, Index N>
T value (Vector< T, N > const &x)
template<typename T, Index N>
Vector< T, N > gradient (Vector< T, N > const &x) const
template<typename T, Index N>
Tensor< T, N > hessian (Vector< T, N > const &x)
Public Member Functions inherited from minitensor::Function_Base< SquareRoot< S, 1 >, S, 1 >
 Function_Base ()
T value (SquareRoot< S, 1 > &f, Vector< T, N > const &x)
Vector< T, N > gradient (SquareRoot< S, 1 > &f, Vector< T, N > const &x)
Vector< T, N > residual (SquareRoot< S, 1 > &f, Vector< T, N > const &x)
Tensor< T, N > hessian (SquareRoot< S, 1 > &f, Vector< T, N > const &x)
void set_failed (char const *const msg=nullptr)
bool get_failed ()
void clear_failed ()
void set_failure_message (char const *const msg=nullptr)
char const * get_failure_message ()

Static Public Attributes

static constexpr char const *const NAME {"Square Root"}
Static Public Attributes inherited from minitensor::Function_Base< SquareRoot< S, 1 >, S, 1 >
static constexpr Index DIMENSION

Private Attributes

S const c_ {0.0}

Additional Inherited Members

Protected Attributes inherited from minitensor::Function_Base< SquareRoot< S, 1 >, S, 1 >
bool failed
char const * failure_message
 Keep a message to inform what went wrong above.

Detailed Description

template<typename S, Index M = 1>
class minitensor::SquareRoot< S, M >

Square root NLS: the residual is \( r(x) = x^2 - c \), whose root is \( x = \sqrt{c} \). One-dimensional test for nonlinear system solvers.

Definition at line 33 of file MiniTensor_TestFunctions.h.

Member Typedef Documentation

◆ Base

template<typename S, Index M = 1>
using minitensor::SquareRoot< S, M >::Base = Function_Base<SquareRoot<S, M>, S, M>

Base class type.

Definition at line 55 of file MiniTensor_TestFunctions.h.

Constructor & Destructor Documentation

◆ SquareRoot()

template<typename S, Index M = 1>
minitensor::SquareRoot< S, M >::SquareRoot ( S const c)
inline

Constructor.

Parameters
cValue whose square root is sought.

Definition at line 41 of file MiniTensor_TestFunctions.h.

Member Function Documentation

◆ value()

template<typename S, Index M = 1>
template<typename T, Index N>
T minitensor::SquareRoot< S, M >::value ( Vector< T, N > const & x)
inline

Objective value.

Definition at line 63 of file MiniTensor_TestFunctions.h.

◆ gradient()

template<typename S, Index M = 1>
template<typename T, Index N>
Vector< T, N > minitensor::SquareRoot< S, M >::gradient ( Vector< T, N > const & x) const
inline

Gradient of the objective.

Definition at line 74 of file MiniTensor_TestFunctions.h.

◆ hessian()

template<typename S, Index M = 1>
template<typename T, Index N>
Tensor< T, N > minitensor::SquareRoot< S, M >::hessian ( Vector< T, N > const & x)
inline

Hessian of the objective.

Definition at line 95 of file MiniTensor_TestFunctions.h.

Member Data Documentation

◆ NAME

template<typename S, Index M = 1>
char const* const minitensor::SquareRoot< S, M >::NAME {"Square Root"}
staticconstexpr

Function name.

Definition at line 50 of file MiniTensor_TestFunctions.h.

◆ c_

template<typename S, Index M = 1>
S const minitensor::SquareRoot< S, M >::c_ {0.0}
private

Value whose square root is sought.

Definition at line 105 of file MiniTensor_TestFunctions.h.


The documentation for this class was generated from the following file: