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,
20  class t_InputMatrixType>
21  static void compute(t_OutputMatrixType & U_inverse,
22  const t_InputMatrixType & L)
23  {
24  MatrixIndex size = L.rows();
25 
26  for (MatrixIndex i = 0; i < size; ++i)
27  {
28  U_inverse(i,i) = 1.0 / L(i, i);
29  for (MatrixIndex j = i-1; j >= 0; --j)
30  {
31  double tmp = L.transpose().row(j).segment(j+1, i-j)*U_inverse.col(i).segment(j+1, i-j);
32  U_inverse(j, i) = - tmp / L(j,j);
33  }
34  }
35  }
36  };
37 }
int MatrixIndex
Definition: common.h:32
static void compute(t_OutputMatrixType &U_inverse, const t_InputMatrixType &L)
Definition: inverse.h:21