SOPT
Sparse OPTimisation
gradient_utils.h
Go to the documentation of this file.
1 #ifndef SOPT_GRADIENT_UTILS_H
2 #define SOPT_GRADIENT_UTILS_H
3 
4 #include "sopt/types.h"
6 #include <memory>
7 
8 namespace sopt {
9 
12 template <typename T>
14  public:
16  {
17  _Phi = std::make_shared<sopt::LinearTransform<T>>(linear_transform_identity<T>());
18  }
19 
21  std::shared_ptr<sopt::LinearTransform<T>> Phi)
22  : _target(target) {
23  _Phi = Phi;
24  }
25 
26  const T& target() const { return _target; }
27 
28  const sopt::LinearTransform<T>& Phi() const { return *_Phi; }
29 
30  void Phi(const sopt::LinearTransform<T> &new_phi)
31  {
32  _Phi = std::make_shared<sopt::LinearTransform<T>>(new_phi);
33  }
34 
35  private:
36  const T _target;
37 
38  std::shared_ptr<sopt::LinearTransform<T>> _Phi;
39 };
40 
41 } // namespace sopt
42 #endif
IterationState(const T &target, std::shared_ptr< sopt::LinearTransform< T >> Phi)
void Phi(const sopt::LinearTransform< T > &new_phi)
const T & target() const
const sopt::LinearTransform< T > & Phi() const
IterationState(const T &target)
Joins together direct and indirect operators.