Exemplo n.º 1
0
 BOOST_FORCEINLINE result_type operator()( A0& a, A1& b, A2& alpha, A3& beta, A4& vr, A5& vl) const
 {
   result_type info = 0;
   char jobvr = 'V';
   char jobvl = 'V';
   details::workspace<typename A0::value_type> wk;
   nt2_la_int n = nt2::width(a);
   BOOST_ASSERT_MSG(  (n == nt2_la_int(nt2::height(a)))
                      &&(n == nt2_la_int(nt2::height(b))) , "inputs must be square");
   nt2_la_int lda  = nt2::max(a.leading_size(), One<size_t>());
   nt2_la_int ldb  = nt2::max(b.leading_size(), One<size_t>());
   nt2_la_int ldvl = n;
   nt2_la_int ldvr = n;
   NT2_F77NAME(zggev) ( &jobvl, &jobvr
                      , &n
                      , 0 /*a*/, &lda
                      , 0 /*b*/, &ldb
                      , 0/*alpha*/
                      , 0/*beta*/
                      , 0/*vl*/, &ldvl
                      , 0/*vr*/, &ldvr
                      , wk.main(), details::query()
                      , wk.reals()
                      , &info);
   info = nt2::ggev_wvrvl(a, b, alpha, beta, vr, vl, wk);
   return info;
 }
Exemplo n.º 2
0
 //==========================================================================
 /// INTERNAL ONLY - X = LINSOLVE(A,B) -- symmetric shape
 BOOST_FORCEINLINE
 void eval ( A0 const& a0, A1 const& a1 , A2 const& a2 ,boost::mpl::long_<1> const
           , nt2::symmetric_ const&) const
 {
   type_t rcond;
   nt2::container::table<nt2_la_int> piv = nt2::zeros(a0.leading_size(), 1
                                         , nt2::meta::as_<nt2_la_int>() );
   boost::proto::child_c<0>(a2).resize(nt2::of_size(a0.leading_size(),1));
   NT2_AS_TERMINAL_IN(desired_semantic1,a,a0);
   NT2_AS_TERMINAL_IN(desired_semantic,b,a1);
   nt2_la_int iter = nt2::sysvx( boost::proto::value(a),boost::proto::value(piv)
                              , boost::proto::value(b)
                              , boost::proto::value(boost::proto::child_c<0>(a2))
                              , rcond);
   boost::ignore_unused(iter);
 }
Exemplo n.º 3
0
Arquivo: gesvd.hpp Projeto: psiha/nt2
    BOOST_FORCEINLINE result_type operator()( A0& a0, A1& s, A2& u,A3 &vt, A4 const jobu
            , A5 const jobvt) const
    {
        result_type that;
        details::workspace<typename A0::value_type> w;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();
        nt2_la_int ldu = u.leading_size() > 1 ? u.leading_size() : 1 ;
        nt2_la_int ldvt= vt.leading_size() > 1 ? vt.leading_size() : 1 ;
        nt2_la_int lwork_query = -1;

        char c = std::toupper(jobu);
        magma_vec_t magma_jobu  = c == 'A' ? MagmaAllVec : c == 'S' ? MagmaSomeVec : c == 'O' ? MagmaOverwriteVec : c == 'N' ? MagmaNoVec : (magma_vec_t)0;
        c = std::toupper(jobvt);
        magma_vec_t magma_jobvt = c == 'A' ? MagmaAllVec : c == 'S' ? MagmaSomeVec : c == 'O' ? MagmaOverwriteVec : c == 'N' ? MagmaNoVec : (magma_vec_t)0;

        magma_sgesvd(magma_jobu,magma_jobvt,m, n, 0, ld, 0, 0, ldu
                     , 0, ldvt, w.main()
                     , lwork_query, &that
                    );

        w.prepare_main();
        nt2::gesvd(a0,s,u,vt,jobu,jobvt,w);

        return that;
    }
Exemplo n.º 4
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1 const& a1) const
     {
        result_type that;
        nt2_la_int n   = nt2::width(a0);
        nt2_la_int lda = a0.leading_size();

        NT2_F77NAME(zpotrf) (&a1,&n,a0.raw(),&lda,&that);

        return that;
     }
Exemplo n.º 5
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1 const a1) const
     {
        result_type that;
        nt2_la_int n   = nt2::width(a0);
        nt2_la_int lda = a0.leading_size();

        magma_zpotrf(a1,n,(cuDoubleComplex*)a0.raw(),lda,&that);

        return that;
     }
Exemplo n.º 6
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const
     {
        result_type that;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();

        a1.resize( nt2::of_size(std::min(n, m), 1) );

        magma_cgetrf(m, n, (cuFloatComplex*)a0.data(), ld, a1.data(), &that);
        return that;
     }
Exemplo n.º 7
0
 BOOST_FORCEINLINE result_type operator()( A0& a, A1& scale
                                         , A2& ilo, A3& ihi, C0 job) const
 {
    result_type info;
    nt2_la_int  n   = nt2::width(a);
    BOOST_ASSERT_MSG(n == nt2_la_int(nt2::height(a)), "input must be square");
    nt2_la_int  lda = nt2::max(a.leading_size(), One<size_t>());
    NT2_F77NAME(cgebal) (&job, &n
                        , a.raw(), &lda
                        , &ilo, &ihi
                        , scale.raw(), &info);
    return info;
 }
Exemplo n.º 8
0
 //==========================================================================
 /// INTERNAL ONLY - X = LINSOLVE(A,B) -- positive definite shape
 BOOST_FORCEINLINE
 void eval ( A0 const& a0, A1 const& a1 , A2 const& a2 ,boost::mpl::long_<1> const
           , nt2::positive_definite_ const&) const
 {
   type_t rcond;
   boost::proto::child_c<0>(a2).resize(nt2::of_size(a0.leading_size(),1));
   NT2_AS_TERMINAL_IN(desired_semantic1,a,a0);
   NT2_AS_TERMINAL_IN(desired_semantic,b,a1);
   nt2_la_int iter = nt2::posvx( boost::proto::value(a), boost::proto::value(b)
                               , boost::proto::value(boost::proto::child_c<0>(a2))
                               , rcond);
   boost::ignore_unused(iter);
 }
Exemplo n.º 9
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const
     {
        result_type that;
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();
        nt2_la_int  ldb = a1.leading_size();
        nt2_la_int  nhrs = nt2::width(a1);
        char uplo = 'L';

        NT2_F77NAME(zposv) ( &uplo, &n, &nhrs, a0.data(), &ld, a1.data(), &ldb
                           , &that
                            );

        return that;
     }
Exemplo n.º 10
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const
     {
        result_type that;
        details::workspace<typename A0::value_type> w;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();

        NT2_F77NAME(sgeqp3) (&m, &n, 0, &ld, 0, 0, w.main()
                            , details::query(), &that
                            );

          w.prepare_main();
          nt2::geqp3(a0,a1,a2,w);

        return that;
     }
Exemplo n.º 11
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const
     {
        result_type that;
        details::workspace<typename A0::value_type> w;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();
        nt2_la_int lwork_query = -1;

        magma_sgeqp3 (m, n, 0, ld, 0, 0, w.main()
                            , lwork_query, &that
                            );
          w.prepare_main();
          nt2::geqp3(a0,a1,a2,w);

        return that;
     }
Exemplo n.º 12
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2) const
     {
        result_type that;
        details::workspace<typename A2::value_type> w;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  ld = a0.leading_size();
        nt2_la_int  k  = a1.leading_size();
        char side  = 'L';
        char trans = 'N';

        NT2_F77NAME(sormqr) (&side,&trans,&m, &m, &k, 0, &ld, 0, 0, &m, w.main()
                            , details::query(), &that
                            );
        w.prepare_main();

        nt2::mqr(a0,a1,a2,w);

        return that;
     }
Exemplo n.º 13
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& s, A2& u,A3 &vt, A4 jobu, A5 jobvt) const
     {
        result_type that;
        details::workspace<typename A0::value_type> w;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();
        nt2_la_int ldu = u.leading_size() > 1 ? u.leading_size() : 1 ;
        nt2_la_int ldvt= vt.leading_size() > 1 ? vt.leading_size() : 1 ;

        NT2_F77NAME(sgesvd) (&jobu,&jobvt,&m, &n, 0, &ld, 0, 0, &ldu
                            , 0, &ldvt, w.main()
                            , details::query(), &that
                            );

        w.resize_main(5*nt2::max(m, n));
        nt2::gesvd(a0,s,u,vt,jobu,jobvt,w);

        return that;
     }
Exemplo n.º 14
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& s) const
     {
        result_type info;
        details::workspace<typename A0::value_type> w;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();
        nt2_la_int ldu = 1 ;
        nt2_la_int ldvt= 1 ;
        char job =  'N';

        NT2_F77NAME(sgesvd) (&job, &job, &m, &n, 0, &ld, 0, 0, &ldu
                            , 0, &ldvt, w.main()
                            , details::query(), &info
                            );

        w.prepare_main();
        w.resize_main(5*nt2::max(m, n));
        nt2::gesvd_w(a0,s,w);

        return info;
     }
Exemplo n.º 15
0
     BOOST_FORCEINLINE result_type operator()( A0& a0, A1& s) const
     {
        result_type that;
        details::workspace<typename A0::value_type> w;
        nt2_la_int  m  = nt2::height(a0);
        nt2_la_int  n  = nt2::width(a0);
        nt2_la_int  ld = a0.leading_size();
        nt2_la_int ldu = 1;
        nt2_la_int ldvt= 1;
        nt2_la_int lwork_query = -1;
        magma_vec_t magma_jobu  = MagmaNoVec ;

        magma_sgesvd(magma_jobu,magma_jobu,m, n, 0, ld, 0, 0, ldu
                            , 0, ldvt, w.main()
                            , lwork_query, &that
                            );

        w.prepare_main();
        nt2::gesvd_w(a0,s,w);

        return that;
     }
Exemplo n.º 16
0
 BOOST_FORCEINLINE result_type operator()( A0& a, A1& w) const
 {
   char jobvl = 'N';
   char jobvr = 'N';
   result_type info = 0;
   details::workspace<typename A0::value_type> wk;
   nt2_la_int n = nt2::width(a);
   BOOST_ASSERT_MSG(n == nt2_la_int(nt2::height(a)), "input must be square");
   nt2_la_int lda  = nt2::max(a.leading_size(), One<size_t>());
   nt2_la_int ldvl = 1;
   nt2_la_int ldvr = 1;
   NT2_F77NAME(cgeev) ( &jobvl, &jobvr
                      , &n
                      , 0 /*a*/, &lda
                      , 0 /*w*/
                      , 0 /*vl*/, &ldvl
                      , 0 /*vr*/, &ldvr
                      , wk.main(), details::query()
                      , wk.reals()
                      , &info);
  info = nt2::geev_w(a, w, wk);
   return info;
  }