PolyFEM
Loading...
Searching...
No Matches
L2ProjectionForm.cpp
Go to the documentation of this file.
1
3
4namespace polyfem::solver
5{
7 const StiffnessMatrix &M,
8 const StiffnessMatrix &A,
9 const Eigen::VectorXd &y)
10 : M_(M), rhs_(A * y)
11 {
12 }
13
14 double L2ProjectionForm::value_unweighted(const Eigen::VectorXd &x) const
15 {
16 return x.transpose() * (0.5 * (M_ * x) - rhs_);
17 }
18
19 void L2ProjectionForm::first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const
20 {
21 gradv = M_ * x - rhs_;
22 }
23
24 void L2ProjectionForm::second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const
25 {
26 hessian = M_;
27 }
28} // namespace polyfem::solver
int y
int x
void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
Compute the first derivative of the value wrt x.
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the form.
void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override
Compute the second derivative of the value wrt x.
L2ProjectionForm(const StiffnessMatrix &M, const StiffnessMatrix &A, const Eigen::VectorXd &y)
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:22