00001 #ifndef _BAYES_FILTER_MATRIX_SUPPORT
00002 #define _BAYES_FILTER_MATRIX_SUPPORT
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 namespace Bayesian_filter_matrix
00022 {
00023
00024
00025
00026
00027
00028 #ifndef NDEBUG
00029 void assert_isPSD (const SymMatrix &M);
00030 #else
00031 inline void assert_isPSD (const SymMatrix &M) {}
00032 #endif
00033
00034
00035
00036
00037 bool isPSD (const SymMatrix &M);
00038 bool isSymmetric (const Matrix &M);
00039 void forceSymmetric (Matrix &M, bool bUpperToLower = false);
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 Vec::value_type UdUrcond (const Vec& d);
00051 RowMatrix::value_type UdUrcond (const RowMatrix& UD);
00052 RowMatrix::value_type UdUrcond (const RowMatrix& UD, std::size_t n);
00053 UTriMatrix::value_type UCrcond (const UTriMatrix& UC);
00054 SymMatrix::value_type UdUdet (const SymMatrix& UD);
00055
00056
00057 RowMatrix::value_type UdUfactor_variant1 (RowMatrix& M, std::size_t n);
00058 RowMatrix::value_type UdUfactor_variant2 (RowMatrix& M, std::size_t n);
00059 inline RowMatrix::value_type UdUfactor (RowMatrix& M, std::size_t n)
00060 { return UdUfactor_variant2(M,n);
00061 }
00062 LTriMatrix::value_type LdLfactor (LTriMatrix& M, std::size_t n);
00063 UTriMatrix::value_type UCfactor (UTriMatrix& M, std::size_t n);
00064
00065
00066 RowMatrix::value_type UdUfactor (RowMatrix& UD, const SymMatrix& M);
00067 LTriMatrix::value_type LdLfactor (LTriMatrix& LD, const SymMatrix& M);
00068 UTriMatrix::value_type UCfactor (UTriMatrix& UC, const SymMatrix& M);
00069
00070
00071 bool UdUinverse (RowMatrix& UD);
00072 bool UTinverse (UTriMatrix& U);
00073 void UdUrecompose_transpose (RowMatrix& M);
00074 void UdUrecompose (RowMatrix& M);
00075 void UdUrecompose (SymMatrix& X, const RowMatrix& M);
00076 void UdUfromUCholesky (RowMatrix& U);
00077 void UdUseperate (RowMatrix& U, Vec& d, const RowMatrix& UD);
00078 void Lzero (RowMatrix& M);
00079 void Uzero (RowMatrix& M);
00080
00081
00082
00083
00084
00085 SymMatrix::value_type UdUinversePDignoreInfinity (SymMatrix& M);
00086 SymMatrix::value_type UdUinversePD (SymMatrix& M);
00087 SymMatrix::value_type UdUinversePD (SymMatrix& M, SymMatrix::value_type& detM);
00088 SymMatrix::value_type UdUinversePD (SymMatrix& MI, const SymMatrix& M);
00089 SymMatrix::value_type UdUinversePD (SymMatrix& MI, SymMatrix::value_type& detM, const SymMatrix& M);
00090
00091
00092 }
00093
00094 #endif