SOPT
Sparse OPTimisation
Public Types | Public Member Functions | List of all members
sopt::details::MatrixToLinearTransform< EIGEN > Class Template Reference

Wraps a matrix into a function and its conjugate transpose. More...

#include <linear_transform.h>

Public Types

using PlainObject = typename std::conditional< std::is_base_of< Eigen::MatrixBase< PlainMatrix >, PlainMatrix >::value, Vector< typename PlainMatrix::Scalar >, Array< typename PlainMatrix::Scalar > >::type
 The output type. More...
 

Public Member Functions

template<typename T0 >
 MatrixToLinearTransform (Eigen::MatrixBase< T0 > const &A)
 Creates from an expression. More...
 
 MatrixToLinearTransform (std::shared_ptr< EIGEN > const &x)
 Creates from a shared matrix. More...
 
void operator() (PlainObject &out, PlainObject const &x) const
 Performs operation. More...
 
MatrixAdjointToLinearTransform< EIGEN > adjoint () const
 Returns conjugate transpose operator. More...
 

Detailed Description

template<typename EIGEN>
class sopt::details::MatrixToLinearTransform< EIGEN >

Wraps a matrix into a function and its conjugate transpose.

This class helps to wrap matrices into functions, such that we can use and store them such that SDMM algorithms can refer to them.

Definition at line 161 of file linear_transform.h.

Member Typedef Documentation

◆ PlainObject

template<typename EIGEN >
using sopt::details::MatrixToLinearTransform< EIGEN >::PlainObject = typename std::conditional<std::is_base_of<Eigen::MatrixBase<PlainMatrix>, PlainMatrix>::value, Vector<typename PlainMatrix::Scalar>, Array<typename PlainMatrix::Scalar> >::type

The output type.

Definition at line 169 of file linear_transform.h.

Constructor & Destructor Documentation

◆ MatrixToLinearTransform() [1/2]

template<typename EIGEN >
template<typename T0 >
sopt::details::MatrixToLinearTransform< EIGEN >::MatrixToLinearTransform ( Eigen::MatrixBase< T0 > const &  A)
inline

Creates from an expression.

Expression is evaluated and the result stored internally. This object owns a copy of the matrix. It might share it with a few friendly neighbors.

Definition at line 177 of file linear_transform.h.

177 : matrix(std::make_shared<EIGEN>(A)) {}

◆ MatrixToLinearTransform() [2/2]

template<typename EIGEN >
sopt::details::MatrixToLinearTransform< EIGEN >::MatrixToLinearTransform ( std::shared_ptr< EIGEN > const &  x)
inline

Creates from a shared matrix.

Definition at line 179 of file linear_transform.h.

179 : matrix(x){}

Member Function Documentation

◆ adjoint()

template<typename EIGEN >
MatrixAdjointToLinearTransform<EIGEN> sopt::details::MatrixToLinearTransform< EIGEN >::adjoint ( ) const
inline

Returns conjugate transpose operator.

The matrix is shared.

Definition at line 192 of file linear_transform.h.

192  {
193  return MatrixAdjointToLinearTransform<EIGEN>(matrix);
194  }

Referenced by sopt::linear_transform().

◆ operator()()

template<typename EIGEN >
void sopt::details::MatrixToLinearTransform< EIGEN >::operator() ( PlainObject out,
PlainObject const &  x 
) const
inline

Performs operation.

Definition at line 182 of file linear_transform.h.

182  {
183 #ifndef NDEBUG
184  if ((*matrix).cols() != x.size())
185  SOPT_THROW("Input vector and matrix do not match: ")
186  << out.cols() << " columns for " << x.size() << " elements.";
187 #endif
188  out = (*matrix) * x;
189  }
#define SOPT_THROW(MSG)
Definition: exception.h:46

References SOPT_THROW.


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