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

#include <MiniTensor_TestFunctions.h>

Inheritance diagram for minitensor::Quadratic< S, M >:
minitensor::Function_Base< FunctionDerived, S, M >

Public Types

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

Public Member Functions

 Quadratic (S const a, S const b, S const c)
 
template<typename T , Index N>
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< FunctionDerived, S, M >
 Function_Base ()
 
template<typename T , Index N>
value (FunctionDerived &f, Vector< T, N > const &x)
 
template<typename T , Index N>
Vector< T, N > gradient (FunctionDerived &f, Vector< T, N > const &x)
 
template<typename T , Index N>
Vector< T, N > residual (FunctionDerived &f, Vector< T, N > const &x)
 
template<typename T , Index N>
Tensor< T, N > hessian (FunctionDerived &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 {"Quadratic"}
 
- Static Public Attributes inherited from minitensor::Function_Base< FunctionDerived, S, M >
static constexpr Index DIMENSION {M}
 

Private Attributes

S const a_ {0.0}
 
S const b_ {0.0}
 
S const c_ {0.0}
 

Additional Inherited Members

- Protected Attributes inherited from minitensor::Function_Base< FunctionDerived, S, M >
bool failed {false}
 
char const * failure_message {nullptr}
 Keep a message to inform what went wrong above.
 

Detailed Description

template<typename S, Index M = 2>
class minitensor::Quadratic< S, M >

Quadratic NLS: the residual is the gradient of \( c((x_1-a)^2 + (x_2-b)^2) \). Two-dimensional, convex, single minimum at \( (a, b) \).

Definition at line 117 of file MiniTensor_TestFunctions.h.

Member Typedef Documentation

◆ Base

template<typename S , Index M = 2>
using minitensor::Quadratic< S, M >::Base = Function_Base<Quadratic<S, M>, S, M>

Base class type.

Definition at line 140 of file MiniTensor_TestFunctions.h.

Constructor & Destructor Documentation

◆ Quadratic()

template<typename S , Index M = 2>
minitensor::Quadratic< S, M >::Quadratic ( S const  a,
S const  b,
S const  c 
)
inline

Constructor.

Parameters
aFirst coordinate of the minimizer.
bSecond coordinate of the minimizer.
cCurvature scale factor.

Definition at line 126 of file MiniTensor_TestFunctions.h.

Member Function Documentation

◆ value()

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

Objective value.

Definition at line 148 of file MiniTensor_TestFunctions.h.

◆ gradient()

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

Gradient of the objective.

Definition at line 159 of file MiniTensor_TestFunctions.h.

◆ hessian()

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

Hessian of the objective.

Definition at line 181 of file MiniTensor_TestFunctions.h.

Member Data Documentation

◆ NAME

template<typename S , Index M = 2>
constexpr char const* const minitensor::Quadratic< S, M >::NAME {"Quadratic"}
staticconstexpr

Function name.

Definition at line 135 of file MiniTensor_TestFunctions.h.

◆ a_

template<typename S , Index M = 2>
S const minitensor::Quadratic< S, M >::a_ {0.0}
private

First coordinate of the minimizer.

Definition at line 191 of file MiniTensor_TestFunctions.h.

◆ b_

template<typename S , Index M = 2>
S const minitensor::Quadratic< S, M >::b_ {0.0}
private

Second coordinate of the minimizer.

Definition at line 197 of file MiniTensor_TestFunctions.h.

◆ c_

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

Curvature scale factor.

Definition at line 203 of file MiniTensor_TestFunctions.h.


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