I tried to follow the examples for setting up a LinearOperator (such as shown in Step-22 and Step-20), but instead of a matrix I wanted to provide my own function which should serve as vmult-function (i.e. a matrix-free linear operator). Is that possible? My initial test was the following code:
class approximator : public Subscriptor { public: approximator(std::function<void(const Vector<double>&, Vector<double>&)> residual_function, const Vector<double> &evaluation_point) : residual_function(residual_function) { u = evaluation_point; u.add(1); epsilon_val = u.l1_norm() * 1e-6; residual_function(u, residual_0); }; void vmult(Vector<double> &dst, const Vector<double> &src) const; private: std::function<void(const Vector<double>&, Vector<double>&)> residual_function; double epsilon_val; Vector<double> u, residual_0, residual_1; }; const auto op_M = linear_operator(jacobian_approximation(std::bind(& MinimalSurfaceProblem<dim>::compute_residual, this, std:: placeholders::_1, std:: placeholders::_2), present_solution)); but that resulted in error: use of deleted function ‘dealii::LinearOperator<Range, Domain, Payload> dealii::linear_operator(Matrix&&) [with Range = dealii::Vector <double>; Domain = dealii::Vector<double>; Payload = dealii::internal:: LinearOperatorImplementation::EmptyPayload; Matrix = Step15:: jacobian_approximation; <template-parameter-1-5> = void]’ 389 | present_solution)); Are there other ways? Thanks! -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/1cf547d8-4d9b-4826-b0c8-85c2bd2d2f3f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.