PX4 Firmware
PX4 Autopilot Software http://px4.io
PseudoInverse.hpp
Go to the documentation of this file.
1 /**
2  * @file PseudoInverse.hpp
3  *
4  * Implementation of matrix pseudo inverse
5  *
6  * @author Julien Lecoeur <julien.lecoeur@gmail.com>
7  */
8 
9 #pragma once
10 
11 #include "math.hpp"
12 
13 namespace matrix
14 {
15 
16 /**
17  * Full rank Cholesky factorization of A
18  */
19 template<typename Type, size_t N>
21 
22 /**
23  * Geninv implementation detail
24  */
25 template<typename Type, size_t M, size_t N, size_t R> class GeninvImpl;
26 
27 /**
28  * Geninv
29  * Fast pseudoinverse based on full rank cholesky factorisation
30  *
31  * Courrieu, P. (2008). Fast Computation of Moore-Penrose Inverse Matrices, 8(2), 25–29. http://arxiv.org/abs/0804.4809
32  */
33 template<typename Type, size_t M, size_t N>
35 {
36  size_t rank;
37  if (M <= N) {
38  SquareMatrix<Type, M> A = G * G.transpose();
40 
42 
43  } else {
44  SquareMatrix<Type, N> A = G.transpose() * G;
46 
48  }
49 }
50 
51 
52 #include "PseudoInverse.hxx"
53 
54 } // namespace matrix
55 
56 /* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */
Matrix< Type, N, M > transpose() const
Definition: Matrix.hpp:353
static Matrix< Type, N, M > genInvUnderdetermined(const Matrix< Type, M, N > &G, const Matrix< Type, M, M > &L, size_t rank)
SquareMatrix< Type, N > fullRankCholesky(const SquareMatrix< Type, N > &A, size_t &rank)
Full rank Cholesky factorization of A.
static Matrix< Type, N, M > genInvOverdetermined(const Matrix< Type, M, N > &G, const Matrix< Type, N, N > &L, size_t rank)
Geninv implementation detail.
Matrix< Type, N, M > geninv(const Matrix< Type, M, N > &G)
Geninv Fast pseudoinverse based on full rank cholesky factorisation.