qpmad
Eigen-based C++ QP solver.
Loading...
Searching...
No Matches
inverse.h
Go to the documentation of this file.
1/**
2 @file
3 @author Alexander Sherikov
4
5 @copyright 2017 Alexander Sherikov. Licensed under the Apache License,
6 Version 2.0. (see LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7
8 @brief
9*/
10
11
12#pragma once
13
14namespace qpmad
15{
17 {
18 public:
19 template <class t_OutputMatrixType, class t_InputMatrixType>
20 static void compute(t_OutputMatrixType &U_inverse, const t_InputMatrixType &L)
21 {
22 const MatrixIndex size = L.rows();
23
24 for (MatrixIndex i = 0; i < size; ++i)
25 {
26 U_inverse(i, i) = 1.0 / L(i, i);
27 for (MatrixIndex j = i - 1; j >= 0; --j)
28 {
29 const double tmp =
30 L.transpose().row(j).segment(j + 1, i - j) * U_inverse.col(i).segment(j + 1, i - j);
31 U_inverse(j, i) = -tmp / L(j, j);
32 }
33 }
34 }
35 };
36} // namespace qpmad
static void compute(t_OutputMatrixType &U_inverse, const t_InputMatrixType &L)
Definition: inverse.h:20
EIGEN_DEFAULT_DENSE_INDEX_TYPE MatrixIndex
Definition: common.h:33