|
Optimist
0.0.0
A C++ library for optimization
|
Class container for the linear function. More...
#include <Linear.hh>
Inherits Optimist::Function< Scalar, Scalar, Linear< Scalar > >.
Public Member Functions | |
| Linear () | |
| constexpr std::string | name_impl () const |
| bool | evaluate_impl (const Scalar x, Scalar &out) const |
| bool | first_derivative_impl (const Scalar, Scalar &out) const |
| bool | second_derivative_impl (const Scalar, Scalar &out) const |
| Public Member Functions inherited from Optimist::Function< Scalar, Scalar, Linear< Scalar > > | |
| Function () | |
| constexpr std::string | name () const |
| bool | evaluate (const Scalar &x, Scalar &out) const |
| bool | jacobian (const Scalar &x, FirstDerivative &out) const |
| bool | hessian (const Scalar &x, SecondDerivative &out) const |
| Public Member Functions inherited from Optimist::FunctionBase< Scalar, Scalar, Linear< Scalar > > | |
| FunctionBase () | |
| constexpr std::string | name () const |
| bool | evaluate (const Scalar &x, Scalar &out) const |
| bool | first_derivative (const Scalar &x, FirstDerivative &out) const |
| bool | second_derivative (const Scalar &x, SecondDerivative &out) const |
| constexpr Integer | input_dimension () const |
| constexpr Integer | output_dimension () const |
| const std::vector< Scalar > & | solutions () const |
| const std::vector< Scalar > & | guesses () const |
| const Scalar & | solution (const Integer i) const |
| const Scalar & | guess (const Integer i) const |
| bool | is_solution (const Scalar &x, const Scalar tol=FunctionBase::SQRT_EPSILON) const |
Private Attributes | |
| Scalar | m_m {-1.0} |
| Scalar | m_q {1.0} |
Additional Inherited Members | |
| Public Types inherited from Optimist::FunctionBase< Scalar, Scalar, Linear< Scalar > > | |
| using | InputTrait |
| using | OutputTrait |
| using | Scalar |
| using | FirstDerivative |
| using | SecondDerivative |
| Protected Attributes inherited from Optimist::FunctionBase< Scalar, Scalar, Linear< Scalar > > | |
| std::vector< Scalar > | m_solutions |
| std::vector< Scalar > | m_guesses |
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\).
| Scalar | Floating-point number type. |
|
inline |
Class constructor for the linear function.
|
inline |
Compute the function value at the input point.
| [in] | x | Input point. |
| [out] | out | The function value. |
|
inline |
Compute the first derivative value at the input point.
| [in] | x | Input point. |
| [out] | out | The first derivative value. |
|
inlineconstexpr |
Get the function name.
|
inline |
Compute the second derivative value at the input point.
| [in] | x | Input point. |
| [out] | out | The second derivative value. |
|
private |
Coefficient \( m \).
|
private |
Coefficient \( q \).