Beispiel #1
0
    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;
    }
Beispiel #2
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;
     }