Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Optimist::TestSet::Linear1< Vector > Class Template Reference

Class container for the linear function. More...

#include <Linear.hh>

Inherits Optimist::Function< Vector, Vector, Linear1< Vector > >.

Public Types

using VectorTrait = TypeTrait<Vector>
using Scalar = typename Vector::Scalar
Public Types inherited from Optimist::FunctionBase< Vector, Vector, Linear1< Vector > >
using InputTrait
using OutputTrait
using Scalar
using FirstDerivative
using SecondDerivative

Public Member Functions

 Linear1 ()
constexpr std::string name_impl () const
bool evaluate_impl (const Vector &x, Vector &out) const
bool first_derivative_impl (const Vector &, FirstDerivative &out) const
bool second_derivative_impl (const Vector &, SecondDerivative &out) const
Public Member Functions inherited from Optimist::Function< Vector, Vector, Linear1< Vector > >
 Function ()
constexpr std::string name () const
bool evaluate (const Vector &x, Vector &out) const
bool jacobian (const Vector &x, FirstDerivative &out) const
bool hessian (const Vector &x, SecondDerivative &out) const
Public Member Functions inherited from Optimist::FunctionBase< Vector, Vector, Linear1< Vector > >
 FunctionBase ()
constexpr std::string name () const
bool evaluate (const Vector &x, Vector &out) const
bool first_derivative (const Vector &x, FirstDerivative &out) const
bool second_derivative (const Vector &x, SecondDerivative &out) const
constexpr Integer input_dimension () const
constexpr Integer output_dimension () const
const std::vector< Vector > & solutions () const
const std::vector< Vector > & guesses () const
const Vector & solution (const Integer i) const
const Vector & guess (const Integer i) const
bool is_solution (const Vector &x, const Scalar tol=FunctionBase::SQRT_EPSILON) const

Private Attributes

Scalar m_m {1.0}
Scalar m_q {1.0}

Additional Inherited Members

Protected Attributes inherited from Optimist::FunctionBase< Vector, Vector, Linear1< Vector > >
std::vector< Vector > m_solutions
std::vector< Vector > m_guesses

Detailed Description

template<typename Vector>
requires TypeTrait<Vector>::IsEigen && (!TypeTrait<Vector>::IsFixed || TypeTrait<Vector>::Dimension == 1)
class Optimist::TestSet::Linear1< Vector >

Class container for the linear function, which is defined as:

\[f(x) = mx + q \text{.} \]

The function has roots at

\[x = -\displaystyle\frac{q}{m} \text{.} \]

The default coefficients are \(m = 1\) and \(q = 1\), and the function initial guess is \(x = 0\).

Template Parameters
VectorEigen vector type.

Member Typedef Documentation

◆ Scalar

template<typename Vector>
using Optimist::TestSet::Linear1< Vector >::Scalar = typename Vector::Scalar

◆ VectorTrait

template<typename Vector>
using Optimist::TestSet::Linear1< Vector >::VectorTrait = TypeTrait<Vector>

Constructor & Destructor Documentation

◆ Linear1()

template<typename Vector>
Optimist::TestSet::Linear1< Vector >::Linear1 ( )
inline

Class constructor for the linear function.

Member Function Documentation

◆ evaluate_impl()

template<typename Vector>
bool Optimist::TestSet::Linear1< Vector >::evaluate_impl ( const Vector & x,
Vector & out ) const
inline

Compute the function value at the input point.

Parameters
[in]xInput point.
[out]outThe function value.
Returns
The boolean flag for successful evaluation.

◆ first_derivative_impl()

template<typename Vector>
bool Optimist::TestSet::Linear1< Vector >::first_derivative_impl ( const Vector & ,
FirstDerivative & out ) const
inline

Compute the first derivative value at the input point.

Parameters
[in]xInput point.
[out]outThe first derivative value.
Returns
The boolean flag for successful evaluation.

◆ name_impl()

template<typename Vector>
std::string Optimist::TestSet::Linear1< Vector >::name_impl ( ) const
inlineconstexpr

Get the function name.

Returns
The function name.

◆ second_derivative_impl()

template<typename Vector>
bool Optimist::TestSet::Linear1< Vector >::second_derivative_impl ( const Vector & ,
SecondDerivative & out ) const
inline

Compute the second derivative value at the input point.

Parameters
[in]xInput point.
[out]outThe second derivative value.
Returns
The boolean flag for successful evaluation.

Member Data Documentation

◆ m_m

template<typename Vector>
Scalar Optimist::TestSet::Linear1< Vector >::m_m {1.0}
private

Coefficient \( m \).

◆ m_q

template<typename Vector>
Scalar Optimist::TestSet::Linear1< Vector >::m_q {1.0}
private

Coefficient \( q \).


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