qpmad
Eigen-based C++ QP solver.
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 
14 namespace 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 = L.transpose().row(j).segment(j + 1, i - j) * U_inverse.col(i).segment(j + 1, i - j);
30  U_inverse(j, i) = -tmp / L(j, j);
31  }
32  }
33  }
34  };
35 } // namespace qpmad
EIGEN_DEFAULT_DENSE_INDEX_TYPE MatrixIndex
Definition: common.h:32
static void compute(t_OutputMatrixType &U_inverse, const t_InputMatrixType &L)
Definition: inverse.h:20