1 #ifndef LINEAROPERATOR_H
2 #define LINEAROPERATOR_H
20 virtual const char*
what()
const throw()
22 return "Tried creating a linear operator from an unsupported type. Make sure all necessary headers are included and a child of LinearOperator exists for this type.";
28 template<
typename MatrixType>
31 static std::shared_ptr<LinearOperator>
Create(MatrixType
const& A)
35 return std::shared_ptr<LinearOperator>();
70 virtual Eigen::MatrixXd
Apply(Eigen::Ref<const Eigen::MatrixXd>
const& x) = 0;
73 virtual Eigen::MatrixXd
ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd>
const& x) = 0;
76 virtual void Apply(Eigen::Ref<const Eigen::MatrixXd>
const& x, Eigen::Ref<Eigen::MatrixXd> y);
79 virtual void ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd>
const& x, Eigen::Ref<Eigen::MatrixXd> y);
82 int rows()
const {
return nrows; }
85 int cols()
const {
return ncols; }
88 virtual Eigen::MatrixXd GetMatrix();
90 template<
typename OtherType>
91 static std::shared_ptr<LinearOperator> Create(OtherType
const& A)
104 virtual void GradientImpl(
unsigned int const outputDimWrt,
105 unsigned int const inputDimWrt,
107 Eigen::VectorXd
const& sensitivity)
override;
109 virtual void JacobianImpl(
unsigned int const outputDimWrt,
110 unsigned int const inputDimWrt,
114 unsigned int const inputDimWrt,
116 Eigen::VectorXd
const& vec)
override;
Provides an abstract interface for defining vector-valued model components.
virtual void GradientImpl(unsigned int const outputDimWrt, unsigned int const inputDimWrt, ref_vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &sensitivity)
virtual void ApplyJacobianImpl(unsigned int const outputDimWrt, unsigned int const inputDimWrt, ref_vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &vec)
virtual void EvaluateImpl(ref_vector< boost::any > const &inputs) override
User-implemented function that determines the behavior of this muq::Modeling::WorkPiece.
virtual void JacobianImpl(unsigned int const outputDimWrt, unsigned int const inputDimWrt, ref_vector< Eigen::VectorXd > const &input)
virtual const char * what() const
Generic linear operator base class.
virtual ~LinearOperator()
virtual Eigen::MatrixXd Apply(Eigen::Ref< const Eigen::MatrixXd > const &x)=0
virtual void Apply(Eigen::Ref< const Eigen::MatrixXd > const &x, Eigen::Ref< Eigen::MatrixXd > y)
virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref< const Eigen::MatrixXd > const &x)=0
LinearOperator(int rowsIn, int colsIn, int numInputCols=1)
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...
static std::shared_ptr< LinearOperator > Create(MatrixType const &A)