fn_svd.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 template<typename T1>
00022 inline
00023 bool
00024 svd(Col<typename T1::pod_type>& S, const Base<typename T1::elem_type,T1>& X)
00025 {
00026 arma_extra_debug_sigprint();
00027
00028 typedef typename T1::elem_type eT;
00029
00030
00031
00032
00033 const unwrap<T1> tmp(X.get_ref());
00034 const Mat<eT>& A = tmp.M;
00035
00036 const bool status = auxlib::svd(S, A);
00037
00038 if(status == false)
00039 {
00040 arma_print("svd(): singular value decomposition failed");
00041 }
00042
00043 return status;
00044 }
00045
00046
00047
00048 template<typename T1>
00049 inline
00050 Col<typename T1::pod_type>
00051 svd(const Base<typename T1::elem_type,T1>& X)
00052 {
00053 arma_extra_debug_sigprint();
00054
00055 Col<typename T1::pod_type> out;
00056 svd(out, X);
00057
00058 return out;
00059 }
00060
00061
00062
00063 template<typename T1>
00064 inline
00065 bool
00066 svd
00067 (
00068 Mat<typename T1::elem_type>& U,
00069 Col<typename T1::pod_type>& S,
00070 Mat<typename T1::elem_type>& V,
00071 const Base<typename T1::elem_type,T1>& X
00072 )
00073 {
00074 arma_extra_debug_sigprint();
00075
00076 typedef typename T1::elem_type eT;
00077
00078 const unwrap<T1> tmp(X.get_ref());
00079 const Mat<eT>& A = tmp.M;
00080
00081 const bool status = auxlib::svd(U, S, V, A);
00082
00083 if(status == false)
00084 {
00085 arma_print("svd(): singular value decomposition failed");
00086 }
00087
00088 return status;
00089 }
00090
00091
00092
00093