Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
SchurComplementSolver.cpp
Go to the documentation of this file.
1/* This file is part of MoDELib, distributed under GNU GPL v2. */
3#include <assert.h>
4
5namespace model
6{
7
8 auto SchurComplementSolver::checkDecomposition() const -> void
9 {
10 switch (llt.info())
11 {
12 case Eigen::Success:
13 break;
14
15 case Eigen::NumericalIssue:
16 assert(0 && "SchurComplementSolver found Eigen::NumericalIssue.");
17 break;
18
19 case Eigen::NoConvergence:
20 assert(0 && "SchurComplementSolver found Eigen::NoConvergence.");
21 break;
22
23 case Eigen::InvalidInput:
24 assert(0 && "SchurComplementSolver found Eigen::InvalidInput.");
25 break;
26
27 default:
28 assert(0 && "SchurComplementSolver failed.");
29 break;
30 }
31 }
32
33 SchurComplementSolver::SchurComplementSolver(const Eigen::MatrixXd &KQQ, const Eigen::MatrixXd &KPQ,
34 const Eigen::VectorXd &Fq, const Eigen::VectorXd &Fp)
35 : llt(KQQ), pplu(KPQ * llt.solve(KPQ.transpose()))
36 {
37 checkDecomposition();
38 // solve(KPQ,Fq,Fp);
39 L = pplu.solve(KPQ * llt.solve(Fq) - Fp);
40 X = llt.solve(Fq - KPQ.transpose() * L);
41 }
42
43 SchurComplementSolver::SchurComplementSolver(const Eigen::MatrixXd &KQQ, const Eigen::MatrixXd &KPQ,
44 const Eigen::VectorXd &Fq)
45 : llt(KQQ), pplu(KPQ * llt.solve(KPQ.transpose()))
46 {
47 checkDecomposition();
48 // solve(KPQ,Fq);
49 L = pplu.solve(KPQ * llt.solve(Fq));
50 X = llt.solve(Fq - KPQ.transpose() * L);
51 }
52} // namespace model
const Eigen::LLT< Eigen::MatrixXd > llt
The LLT decomposition of KQQ.
const Eigen::PartialPivLU< Eigen::MatrixXd > pplu
the partial-pivot LU decomposition of KPQ*inv(KQQ)*KPQ^T
Eigen::VectorXd X
The solution vector.
SchurComplementSolver(const Eigen::MatrixXd &KQQ, const Eigen::MatrixXd &KPQ, const Eigen::VectorXd &Fq, const Eigen::VectorXd &Fp)
Eigen::VectorXd L
The vector of Lagrange multipliers.