00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_SYTRD_HPP
00010 #define BOOST_NUMERIC_BINDINGS_LAPACK_SYTRD_HPP
00011
00012 #include <boost/numeric/bindings/lapack/workspace.hpp>
00013 #include <boost/numeric/bindings/traits/vector_traits.hpp>
00014 #include <boost/numeric/bindings/traits/matrix_traits.hpp>
00015 #include <boost/numeric/bindings/traits/type_traits.hpp>
00016 #include <boost/numeric/bindings/traits/detail/array.hpp>
00017 #include <boost/numeric/bindings/traits/traits.hpp>
00018 #include <boost/numeric/bindings/lapack/lapack.h>
00019
00020 #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
00021 # include <boost/static_assert.hpp>
00022 # include <boost/type_traits/is_same.hpp>
00023 #endif
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 namespace boost { namespace numeric { namespace bindings { namespace lapack {
00034
00035 namespace detail {
00036
00037 inline
00038 void sytrd ( char uplo, int n, float* a, int lda, float* d, float* e, float* tau, float* work, int lwork, int& info )
00039 {
00040 LAPACK_SSYTRD( &uplo, &n, a, &lda, d, e, tau, work, &lwork, &info ) ;
00041 }
00042
00043 inline
00044 void sytrd ( char uplo, int n, double* a, int lda, double* d, double* e, double* tau, double* work, int lwork, int& info )
00045 {
00046 LAPACK_DSYTRD( &uplo, &n, a, &lda, d, e, tau, work, &lwork, &info ) ;
00047 }
00048
00049 }
00050
00051
00052 template <typename A, typename D, typename E, typename Tau, typename W>
00053 inline
00054 int sytrd( char uplo, A& a, D& d, E& e, Tau& tau, W& work ) {
00055
00056 int const n = traits::matrix_size1 (a);
00057 assert( traits::matrix_size2 (a) == n );
00058 assert( traits::vector_size (d) == n );
00059 assert( traits::vector_size (e) == n-1 );
00060 assert( traits::vector_size (tau) == n-1 );
00061 assert( uplo=='U' || uplo=='L' );
00062
00063 int lwork = traits::vector_size( work ) ;
00064 assert( lwork >= 1 );
00065
00066 int info;
00067 detail::sytrd( uplo, n,
00068 traits::matrix_storage( a ),
00069 traits::leading_dimension( a ),
00070 traits::vector_storage( d ),
00071 traits::vector_storage( e ),
00072 traits::vector_storage( tau ),
00073 traits::vector_storage( work ), lwork,
00074 info ) ;
00075 return info;
00076 }
00077
00078
00079 template <typename A, typename D, typename E, typename Tau>
00080 inline
00081 int sytrd( char uplo, A& a, D& d, E& e, Tau& tau, optimal_workspace=optimal_workspace() ) {
00082 int info;
00083 detail::sytrd( uplo, traits::matrix_size1( a ),
00084 traits::matrix_storage( a ),
00085 traits::leading_dimension( a ),
00086 traits::vector_storage( d ),
00087 traits::vector_storage( e ),
00088 traits::vector_storage( tau ),
00089 traits::vector_storage( tau ), -1,
00090 info ) ;
00091 if (info) return info ;
00092 int lwork = * traits::vector_storage( tau ) ;
00093
00094 traits::detail::array<typename traits::vector_traits<D>::value_type> work( lwork );
00095
00096 return sytrd( uplo, a, d, e, tau, work ) ;
00097 }
00098
00099
00100 template <typename A, typename D, typename E, typename Tau>
00101 inline
00102 int sytrd( char uplo, A& a, D& d, E& e, Tau& tau, minimal_workspace ) {
00103 int lwork = 1 ;
00104 traits::detail::array<typename traits::vector_traits<D>::value_type> work( lwork );
00105
00106 return sytrd( uplo, a, d, e, tau, work ) ;
00107 }
00108
00109 }}}}
00110
00111 #endif // BOOST_NUMERIC_BINDINGS_LAPACK_GBSV_HPP