SOPT
Sparse OPTimisation
Public Types | Public Member Functions | List of all members
sopt::algorithm::PositiveQuadrant< ALGORITHM > Class Template Reference

Computes according to given algorithm and then projects it to the positive quadrant. More...

#include <positive_quadrant.h>

Public Types

using Algorithm = ALGORITHM
 Underlying algorithm. More...
 
using Scalar = typename Algorithm::Scalar
 Underlying scalar. More...
 
using t_Vector = typename Algorithm::t_Vector
 Underlying vector. More...
 
using t_IsConverged = typename Algorithm::t_IsConverged
 Underlying convergence functions. More...
 
using Diagnostic = typename ALGORITHM::Diagnostic
 Underlying result type. More...
 
using DiagnosticAndResult = typename ALGORITHM::DiagnosticAndResult
 Underlying result type. More...
 

Public Member Functions

 PositiveQuadrant (Algorithm const &algo)
 
 PositiveQuadrant (Algorithm &&algo)
 
Algorithmalgorithm ()
 
Algorithm const & algorithm () const
 
template<typename... T>
Diagnostic operator() (t_Vector &out, T const &... args) const
 Performs algorithm and project results onto positive quadrant. More...
 
template<typename... T>
DiagnosticAndResult operator() (T const &... args) const
 Performs algorithm and project results onto positive quadrant. More...
 

Detailed Description

template<typename ALGORITHM>
class sopt::algorithm::PositiveQuadrant< ALGORITHM >

Computes according to given algorithm and then projects it to the positive quadrant.

C implementation of the reweighted algorithms uses this, even-though the solutions are already constrained to the positive quadrant.

Definition at line 15 of file positive_quadrant.h.

Member Typedef Documentation

◆ Algorithm

template<typename ALGORITHM >
using sopt::algorithm::PositiveQuadrant< ALGORITHM >::Algorithm = ALGORITHM

Underlying algorithm.

Definition at line 18 of file positive_quadrant.h.

◆ Diagnostic

template<typename ALGORITHM >
using sopt::algorithm::PositiveQuadrant< ALGORITHM >::Diagnostic = typename ALGORITHM::Diagnostic

Underlying result type.

Definition at line 26 of file positive_quadrant.h.

◆ DiagnosticAndResult

template<typename ALGORITHM >
using sopt::algorithm::PositiveQuadrant< ALGORITHM >::DiagnosticAndResult = typename ALGORITHM::DiagnosticAndResult

Underlying result type.

Definition at line 28 of file positive_quadrant.h.

◆ Scalar

template<typename ALGORITHM >
using sopt::algorithm::PositiveQuadrant< ALGORITHM >::Scalar = typename Algorithm::Scalar

Underlying scalar.

Definition at line 20 of file positive_quadrant.h.

◆ t_IsConverged

template<typename ALGORITHM >
using sopt::algorithm::PositiveQuadrant< ALGORITHM >::t_IsConverged = typename Algorithm::t_IsConverged

Underlying convergence functions.

Definition at line 24 of file positive_quadrant.h.

◆ t_Vector

template<typename ALGORITHM >
using sopt::algorithm::PositiveQuadrant< ALGORITHM >::t_Vector = typename Algorithm::t_Vector

Underlying vector.

Definition at line 22 of file positive_quadrant.h.

Constructor & Destructor Documentation

◆ PositiveQuadrant() [1/2]

template<typename ALGORITHM >
sopt::algorithm::PositiveQuadrant< ALGORITHM >::PositiveQuadrant ( Algorithm const &  algo)
inline

Definition at line 30 of file positive_quadrant.h.

30 : algorithm_(algo) {}

◆ PositiveQuadrant() [2/2]

template<typename ALGORITHM >
sopt::algorithm::PositiveQuadrant< ALGORITHM >::PositiveQuadrant ( Algorithm &&  algo)
inline

Definition at line 31 of file positive_quadrant.h.

31 : algorithm_(std::move(algo)) {}

Member Function Documentation

◆ algorithm() [1/2]

template<typename ALGORITHM >
Algorithm& sopt::algorithm::PositiveQuadrant< ALGORITHM >::algorithm ( )
inline

Definition at line 33 of file positive_quadrant.h.

33 { return algorithm_; }

Referenced by sopt::algorithm::PositiveQuadrant< ALGORITHM >::operator()().

◆ algorithm() [2/2]

template<typename ALGORITHM >
Algorithm const& sopt::algorithm::PositiveQuadrant< ALGORITHM >::algorithm ( ) const
inline

Definition at line 34 of file positive_quadrant.h.

34 { return algorithm_; }

◆ operator()() [1/2]

template<typename ALGORITHM >
template<typename... T>
DiagnosticAndResult sopt::algorithm::PositiveQuadrant< ALGORITHM >::operator() ( T const &...  args) const
inline

Performs algorithm and project results onto positive quadrant.

Definition at line 46 of file positive_quadrant.h.

46  {
47  auto result = algorithm()(std::forward<T const &>(args)...);
48  result.x = positive_quadrant(result.x);
49  return result;
50  };
PositiveQuadrant< ALGORITHM > positive_quadrant(ALGORITHM const &algo)
Extended algorithm where the solution is projected on the positive quadrant.

References sopt::algorithm::PositiveQuadrant< ALGORITHM >::algorithm(), and sopt::algorithm::positive_quadrant().

◆ operator()() [2/2]

template<typename ALGORITHM >
template<typename... T>
Diagnostic sopt::algorithm::PositiveQuadrant< ALGORITHM >::operator() ( t_Vector out,
T const &...  args 
) const
inline

Performs algorithm and project results onto positive quadrant.

Definition at line 38 of file positive_quadrant.h.

38  {
39  auto const diagnostic = algorithm()(out, std::forward<T const &>(args)...);
40  out = positive_quadrant(out);
41  return diagnostic;
42  };

References sopt::algorithm::PositiveQuadrant< ALGORITHM >::algorithm(), and sopt::algorithm::positive_quadrant().


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