Bayes++ Bayesian Filtering Classes Release 2014.5 - Copyright (c) 2003,2004,2005,2006,2011,2012,2014 Michael Stevens
matSup.hpp
Go to the documentation of this file.
1#ifndef _BAYES_FILTER_MATRIX_SUPPORT
2#define _BAYES_FILTER_MATRIX_SUPPORT
3
4/*
5 * Bayes++ the Bayesian Filtering Library
6 * Copyright (c) 2002 Michael Stevens
7 * See accompanying Bayes++.htm for terms and conditions of use.
8 *
9 * $Id$
10 */
11
12/*
13 * Matrix support functions for filter classes
14 * Members of the Bayesian_filter_matrix namespace are used in the
15 * interface of Bayesian_filter and for internal operations.
16 * Be aware! These functions and their implementation are more likely to change
17 * then those in Bayesian_filter.
18 */
19
20/* Filter Matrix Namespace */
22{
23
24
25/*
26 * Assertion support
27 */
28#ifndef NDEBUG
29void assert_isPSD (const SymMatrix &M);
30#else
31inline void assert_isPSD (const SymMatrix &M) {}
32#endif
33
34/*
35 * Local support functions
36 */
37bool isPSD (const SymMatrix &M);
38bool isSymmetric (const Matrix &M);
39void forceSymmetric (Matrix &M, bool bUpperToLower = false);
40
41/*
42 * UdU' and LdL' and UU' Cholesky Factorisation and function
43 * Very important to manipulate PD and PSD matrices
44 *
45 * Return values:
46 * Many algorithms return a value_type which is a reciprocal condition number
47 * These values are documented for each algorithm and are important way to
48 * determine the validity of the results
49 */
50Vec::value_type UdUrcond (const Vec& d);
51RowMatrix::value_type UdUrcond (const RowMatrix& UD);
52RowMatrix::value_type UdUrcond (const RowMatrix& UD, std::size_t n);
53UTriMatrix::value_type UCrcond (const UTriMatrix& UC);
54SymMatrix::value_type UdUdet (const SymMatrix& UD);
55
56// In-place factorisations
57RowMatrix::value_type UdUfactor_variant1 (RowMatrix& M, std::size_t n);
58RowMatrix::value_type UdUfactor_variant2 (RowMatrix& M, std::size_t n);
59inline RowMatrix::value_type UdUfactor (RowMatrix& M, std::size_t n)
60{ return UdUfactor_variant2(M,n);
61}
62LTriMatrix::value_type LdLfactor (LTriMatrix& M, std::size_t n);
63UTriMatrix::value_type UCfactor (UTriMatrix& M, std::size_t n);
64
65// Copy factorisations
66RowMatrix::value_type UdUfactor (RowMatrix& UD, const SymMatrix& M);
67LTriMatrix::value_type LdLfactor (LTriMatrix& LD, const SymMatrix& M);
68UTriMatrix::value_type UCfactor (UTriMatrix& UC, const SymMatrix& M);
69
70// Factor manipulations
71bool UdUinverse (RowMatrix& UD);
72bool UTinverse (UTriMatrix& U);
74void UdUrecompose (RowMatrix& M);
75void UdUrecompose (SymMatrix& X, const RowMatrix& M);
77void UdUseperate (RowMatrix& U, Vec& d, const RowMatrix& UD);
78void Lzero (RowMatrix& M);
79void Uzero (RowMatrix& M);
80
81/*
82 * Functions using UdU factorisation:
83 * inverse of Positive Definite matrix returning rcond
84 */
85SymMatrix::value_type UdUinversePDignoreInfinity (SymMatrix& M);
86SymMatrix::value_type UdUinversePD (SymMatrix& M);
87SymMatrix::value_type UdUinversePD (SymMatrix& M, SymMatrix::value_type& detM);
88SymMatrix::value_type UdUinversePD (SymMatrix& MI, const SymMatrix& M);
89SymMatrix::value_type UdUinversePD (SymMatrix& MI, SymMatrix::value_type& detM, const SymMatrix& M);
90
91
92}//namespace
93
94#endif
Definition matSup.cpp:34
bool isSymmetric(const Matrix &M)
Definition matSup.cpp:73
RowMatrix::value_type UdUfactor_variant2(RowMatrix &M, std::size_t n)
Definition UdU.cpp:260
SymMatrix::value_type UdUinversePD(SymMatrix &M)
Definition UdU.cpp:820
void UdUrecompose(RowMatrix &M)
Definition UdU.cpp:647
void forceSymmetric(Matrix &M, bool bUpperToLower)
Definition matSup.cpp:100
void UdUfromUCholesky(RowMatrix &U)
Definition UdU.cpp:719
FMMatrix< detail::BaseRowMatrix > RowMatrix
Definition uBLASmatrix.hpp:324
FMMatrix< detail::SymMatrixWrapper< detail::BaseRowMatrix > > SymMatrix
Definition uBLASmatrix.hpp:327
FMVec< detail::BaseVector > Vec
Definition uBLASmatrix.hpp:323
bool isPSD(const SymMatrix &M)
Definition matSup.cpp:54
void Uzero(RowMatrix &M)
Definition UdU.cpp:701
Vec::value_type UdUrcond(const Vec &d)
Definition UdU.cpp:119
LTriMatrix::value_type LdLfactor(LTriMatrix &M, std::size_t n)
Definition UdU.cpp:330
bool UTinverse(UTriMatrix &U)
Definition UdU.cpp:560
RowMatrix::value_type UdUfactor_variant1(RowMatrix &M, std::size_t n)
Definition UdU.cpp:193
void assert_isPSD(const SymMatrix &M)
Definition matSup.cpp:38
FMMatrix< detail::BaseUpperTriMatrix > UTriMatrix
Definition uBLASmatrix.hpp:328
UTriMatrix::value_type UCrcond(const UTriMatrix &UC)
Definition UdU.cpp:147
RowMatrix Matrix
Definition uBLASmatrix.hpp:325
FMMatrix< detail::BaseLowerTriMatrix > LTriMatrix
Definition uBLASmatrix.hpp:329
UTriMatrix::value_type UCfactor(UTriMatrix &M, std::size_t n)
Definition UdU.cpp:392
RowMatrix::value_type UdUfactor(RowMatrix &M, std::size_t n)
Definition matSup.hpp:59
SymMatrix::value_type UdUdet(const SymMatrix &UD)
Definition UdU.cpp:176
void UdUrecompose_transpose(RowMatrix &M)
Definition UdU.cpp:602
void UdUseperate(RowMatrix &U, Vec &d, const RowMatrix &UD)
Definition UdU.cpp:751
bool UdUinverse(RowMatrix &UD)
Definition UdU.cpp:511
void Lzero(RowMatrix &M)
Definition UdU.cpp:684
SymMatrix::value_type UdUinversePDignoreInfinity(SymMatrix &M)
Definition UdU.cpp:793