1 #ifndef LINEAROPERATOR_H
2 #define LINEAROPERATOR_H
24 msg =
"Tried creating a linear operator from an unsupported type " + type +
". Make sure all necessary headers are included and a child of LinearOperator exists for this type.";
27 virtual const char*
what()
const throw()
37 template<
typename MatrixType>
40 static std::shared_ptr<LinearOperator>
Create(MatrixType
const& A)
44 return std::shared_ptr<LinearOperator>();
79 virtual Eigen::MatrixXd
Apply(Eigen::Ref<const Eigen::MatrixXd>
const& x) = 0;
82 virtual Eigen::MatrixXd
ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd>
const& x) = 0;
85 virtual void Apply(Eigen::Ref<const Eigen::MatrixXd>
const& x, Eigen::Ref<Eigen::MatrixXd> y);
88 virtual void ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd>
const& x, Eigen::Ref<Eigen::MatrixXd> y);
91 int rows()
const {
return nrows; }
94 int cols()
const {
return ncols; }
97 virtual Eigen::MatrixXd GetMatrix();
99 template<
typename OtherType>
100 static std::shared_ptr<LinearOperator> Create(OtherType
const& A)
113 virtual void GradientImpl(
unsigned int const outputDimWrt,
114 unsigned int const inputDimWrt,
116 Eigen::VectorXd
const& sensitivity)
override;
118 virtual void JacobianImpl(
unsigned int const outputDimWrt,
119 unsigned int const inputDimWrt,
123 unsigned int const inputDimWrt,
125 Eigen::VectorXd
const& vec)
override;
131 Eigen::VectorXd
const& sens,
132 Eigen::VectorXd
const& vec)
override;
virtual const char * what() const
LinearOperatorTypeException(std::string const &type)
Generic linear operator base class.
virtual ~LinearOperator()
LinearOperator(int rowsIn, int colsIn, int numInputCols=1)
virtual Eigen::MatrixXd Apply(Eigen::Ref< const Eigen::MatrixXd > const &x)=0
virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref< const Eigen::MatrixXd > const &x)=0
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 void ApplyHessianImpl(unsigned int const outWrt, unsigned int const inWrt1, unsigned int const inWrt2, ref_vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &sens, Eigen::VectorXd const &vec)
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...
std::string demangle(const char *name)
static std::shared_ptr< LinearOperator > Create(MatrixType const &A)