Mercurial > octave
diff liboctave/numeric/svd.h @ 22329:7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 17 Aug 2016 10:55:38 -0400 |
parents | bac0d6f07a3e |
children | 4caa7b28d183 |
line wrap: on
line diff
--- a/liboctave/numeric/svd.h Wed Aug 17 10:37:57 2016 -0400 +++ b/liboctave/numeric/svd.h Wed Aug 17 10:55:38 2016 -0400 @@ -30,90 +30,87 @@ namespace octave { -namespace math -{ - -template <typename T> -class -svd -{ -public: - - typedef typename T::real_diag_matrix_type DM_T; - - enum class Type - { - std, - economy, - sigma_only - }; - - enum class Driver + namespace math { - GESVD, - GESDD - }; + template <typename T> + class + svd + { + public: + + typedef typename T::real_diag_matrix_type DM_T; - svd (void) - : m_type (), m_driver (), left_sm (), sigma (), right_sm () - { } + enum class Type + { + std, + economy, + sigma_only + }; - svd (const T& a, svd::Type type = svd::Type::std, - svd::Driver driver = svd::Driver::GESVD); + enum class Driver + { + GESVD, + GESDD + }; - svd (const svd& a) - : m_type (a.m_type), m_driver (a.m_driver), left_sm (a.left_sm), - sigma (a.sigma), right_sm (a.right_sm) - { } + svd (void) + : m_type (), m_driver (), left_sm (), sigma (), right_sm () + { } + + svd (const T& a, svd::Type type = svd::Type::std, + svd::Driver driver = svd::Driver::GESVD); + + svd (const svd& a) + : m_type (a.m_type), m_driver (a.m_driver), left_sm (a.left_sm), + sigma (a.sigma), right_sm (a.right_sm) + { } - svd& operator = (const svd& a) - { - if (this != &a) + svd& operator = (const svd& a) { - m_type = a.m_type; - left_sm = a.left_sm; - sigma = a.sigma; - right_sm = a.right_sm; - m_driver = a.m_driver; + if (this != &a) + { + m_type = a.m_type; + left_sm = a.left_sm; + sigma = a.sigma; + right_sm = a.right_sm; + m_driver = a.m_driver; + } + + return *this; } - return *this; - } + ~svd (void) { } + + T left_singular_matrix (void) const; - ~svd (void) { } + DM_T singular_values (void) const { return sigma; } - T left_singular_matrix (void) const; - - DM_T singular_values (void) const { return sigma; } + T right_singular_matrix (void) const; - T right_singular_matrix (void) const; - -private: + private: - typedef typename T::element_type P; - typedef typename DM_T::element_type DM_P; + typedef typename T::element_type P; + typedef typename DM_T::element_type DM_P; - svd::Type m_type; - svd::Driver m_driver; + svd::Type m_type; + svd::Driver m_driver; - T left_sm; - DM_T sigma; - T right_sm; - - void gesvd (char& jobu, char& jobv, octave_idx_type m, octave_idx_type n, - P* tmp_data, octave_idx_type m1, DM_P* s_vec, P* u, P* vt, - octave_idx_type nrow_vt1, std::vector<P>& work, octave_idx_type& lwork, - octave_idx_type& info); + T left_sm; + DM_T sigma; + T right_sm; - void gesdd (char& jobz, octave_idx_type m, octave_idx_type n, - P* tmp_data, octave_idx_type m1, DM_P* s_vec, P* u, P* vt, - octave_idx_type nrow_vt1, std::vector<P>& work, - octave_idx_type& lwork, - octave_idx_type* iwork, octave_idx_type& info); + void gesvd (char& jobu, char& jobv, octave_idx_type m, octave_idx_type n, + P* tmp_data, octave_idx_type m1, DM_P* s_vec, P* u, P* vt, + octave_idx_type nrow_vt1, std::vector<P>& work, + octave_idx_type& lwork, octave_idx_type& info); -}; - -} + void gesdd (char& jobz, octave_idx_type m, octave_idx_type n, + P* tmp_data, octave_idx_type m1, DM_P* s_vec, P* u, P* vt, + octave_idx_type nrow_vt1, std::vector<P>& work, + octave_idx_type& lwork, + octave_idx_type* iwork, octave_idx_type& info); + }; + } } #endif