simplifications
This commit is contained in:
@@ -225,11 +225,11 @@ class auxlib
|
||||
inline static bool svd(Col<T>& S, Mat< std::complex<T> >& A);
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X);
|
||||
template<typename eT>
|
||||
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X);
|
||||
template<typename T>
|
||||
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool svd_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A, const char mode);
|
||||
@@ -245,11 +245,11 @@ class auxlib
|
||||
inline static bool svd_dc(Col<T>& S, Mat< std::complex<T> >& A);
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X);
|
||||
template<typename eT>
|
||||
inline static bool svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X);
|
||||
template<typename T>
|
||||
inline static bool svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool svd_dc_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A);
|
||||
|
||||
@@ -3430,17 +3430,15 @@ auxlib::svd(Col<T>& S, Mat< std::complex<T> >& A)
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename eT>
|
||||
inline
|
||||
bool
|
||||
auxlib::svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X)
|
||||
auxlib::svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
Mat<eT> A(X.get_ref());
|
||||
|
||||
if(A.is_empty())
|
||||
{
|
||||
U.eye(A.n_rows, A.n_rows);
|
||||
@@ -3502,7 +3500,7 @@ auxlib::svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X)
|
||||
arma_ignore(U);
|
||||
arma_ignore(S);
|
||||
arma_ignore(V);
|
||||
arma_ignore(X);
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("svd(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
@@ -3511,10 +3509,10 @@ auxlib::svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X)
|
||||
|
||||
|
||||
|
||||
template<typename T, typename T1>
|
||||
template<typename T>
|
||||
inline
|
||||
bool
|
||||
auxlib::svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X)
|
||||
auxlib::svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
@@ -3522,8 +3520,6 @@ auxlib::svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, con
|
||||
{
|
||||
typedef std::complex<T> eT;
|
||||
|
||||
Mat<eT> A(X.get_ref());
|
||||
|
||||
if(A.is_empty())
|
||||
{
|
||||
U.eye(A.n_rows, A.n_rows);
|
||||
@@ -3586,7 +3582,7 @@ auxlib::svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, con
|
||||
arma_ignore(U);
|
||||
arma_ignore(S);
|
||||
arma_ignore(V);
|
||||
arma_ignore(X);
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("svd(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
@@ -3967,17 +3963,15 @@ auxlib::svd_dc(Col<T>& S, Mat< std::complex<T> >& A)
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename eT>
|
||||
inline
|
||||
bool
|
||||
auxlib::svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X)
|
||||
auxlib::svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
Mat<eT> A(X.get_ref());
|
||||
|
||||
if(A.is_empty())
|
||||
{
|
||||
U.eye(A.n_rows, A.n_rows);
|
||||
@@ -4042,7 +4036,7 @@ auxlib::svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X)
|
||||
arma_ignore(U);
|
||||
arma_ignore(S);
|
||||
arma_ignore(V);
|
||||
arma_ignore(X);
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("svd(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
@@ -4051,10 +4045,10 @@ auxlib::svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X)
|
||||
|
||||
|
||||
|
||||
template<typename T, typename T1>
|
||||
template<typename T>
|
||||
inline
|
||||
bool
|
||||
auxlib::svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X)
|
||||
auxlib::svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
@@ -4062,8 +4056,6 @@ auxlib::svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V,
|
||||
{
|
||||
typedef std::complex<T> eT;
|
||||
|
||||
Mat<eT> A(X.get_ref());
|
||||
|
||||
if(A.is_empty())
|
||||
{
|
||||
U.eye(A.n_rows, A.n_rows);
|
||||
@@ -4128,7 +4120,7 @@ auxlib::svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V,
|
||||
arma_ignore(U);
|
||||
arma_ignore(S);
|
||||
arma_ignore(V);
|
||||
arma_ignore(X);
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("svd(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,8 @@ svd
|
||||
arma_extra_debug_sigprint();
|
||||
arma_ignore(junk);
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
arma_debug_check
|
||||
(
|
||||
( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)(&V)) ),
|
||||
@@ -108,8 +110,9 @@ svd
|
||||
|
||||
arma_debug_check( ((sig != 's') && (sig != 'd')), "svd(): unknown method specified" );
|
||||
|
||||
// auxlib::svd() makes an internal copy of X
|
||||
const bool status = (sig == 'd') ? auxlib::svd_dc(U, S, V, X) : auxlib::svd(U, S, V, X);
|
||||
Mat<eT> A(X.get_ref());
|
||||
|
||||
const bool status = (sig == 'd') ? auxlib::svd_dc(U, S, V, A) : auxlib::svd(U, S, V, A);
|
||||
|
||||
if(status == false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user