Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_MATH_BIG_SVD_IMPL_ATLAS_H
00002 #define OPENTISSUE_CORE_MATH_BIG_SVD_IMPL_ATLAS_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
00013 #include <boost/numeric/bindings/traits/ublas_vector.hpp>
00014 #include <boost/numeric/bindings/traits/ublas_symmetric.hpp>
00015 #include <boost/numeric/bindings/lapack/gesvd.hpp>
00016
00017 namespace lapack = boost::numeric::bindings::lapack;
00018
00019 #include <OpenTissue/core/math/big/big_types.h>
00020
00021 #include <stdexcept>
00022
00023 namespace OpenTissue
00024 {
00025 namespace math
00026 {
00027 namespace big
00028 {
00029 namespace details
00030 {
00031
00043 template<typename ME>
00044 inline void svd_impl_atlas(
00045 ublas::matrix_expression<ME> const & A
00046 , ublas::matrix<typename ME::value_type, ublas::column_major> & U
00047 , ublas::vector<typename ME::value_type> & s
00048 , ublas::matrix<typename ME::value_type, ublas::column_major> & VT
00049 )
00050 {
00051 typedef typename ME::size_type size_type;
00052 typedef typename ME::value_type value_type;
00053 typedef ublas::matrix<value_type, ublas::column_major> column_major_matrix_type;
00054
00055
00056 size_type m = A().size1();
00057 size_type n = A().size2();
00058
00059 if(m<1)
00060 throw std::invalid_argument("svd(): A did not have any rows?");
00061 if(n<1)
00062 throw std::invalid_argument("svd(): A did not have any columns?");
00063
00064 column_major_matrix_type Acpy( m, n );
00065 Acpy = A();
00066
00067 U.resize(m,n,false);
00068 s.resize(n,false);
00069 VT.resize(n,n,false);
00070
00071 lapack::gesvd( Acpy, s, U, VT );
00072 }
00073
00074
00075 }
00076 }
00077 }
00078 }
00079
00080
00081 #endif