suanPan
TestSolver.h
Go to the documentation of this file.
1 #ifndef TESTSOLVER_H
2 #define TESTSOLVER_H
3 
4 #include <suanPan.h>
5 
6 struct System {
7  mat A;
8 
9  explicit System(mat&& AA)
10  : A(std::move(AA)) {}
11 
12  [[nodiscard]] vec evaluate(const vec& x) const { return A * x; }
13 };
14 
16  [[nodiscard]] vec evaluate(const vec& x) const { return square(x); }
17 };
18 
19 class Quadratic {
20 public:
21  [[nodiscard]] vec evaluate_residual(const vec& x) const { return square(x) - 1.; }
22 
23  [[nodiscard]] mat evaluate_jacobian(const vec& x) const { return diagmat(2. * x); }
24 };
25 
26 #endif // TESTSOLVER_H
Definition: TestSolver.h:19
mat evaluate_jacobian(const vec &x) const
Definition: TestSolver.h:23
vec evaluate_residual(const vec &x) const
Definition: TestSolver.h:21
Definition: TestSolver.h:15
vec evaluate(const vec &x) const
Definition: TestSolver.h:16
Definition: TestSolver.h:6
vec evaluate(const vec &x) const
Definition: TestSolver.h:12
System(mat &&AA)
Definition: TestSolver.h:9
mat A
Definition: TestSolver.h:7