Esempio n. 1
0
 BOOST_FORCEINLINE void
 combine_eigens(const T& wr,  const T& wi, A0& w)
 {
   typedef typename A0::value_type type_t;
   int n = numel(wr);
   w.resize(of_size(n, 1));
   nt2::container::table<type_t, nt2::shared_> sw(of_size(n, 1), share(w.data(), w.data()+n));
   sw = tocomplex(wr, wi);
 }
Esempio n. 2
0
    BOOST_FORCEINLINE result_type operator()(A0& a0, A1 a1, nt2::symmetric_ const&) const
    {
      result_type norm;
      char uplo = 'L';
      nt2_la_int n = nt2::width(a0);
      nt2_la_int ld = n;

     if(a1 =='I'|| a1 =='1'|| a1 =='O')
     {
        nt2::memory::container<tag::table_, result_type, nt2::_2D> work(nt2::of_size(n,1));
        norm = NT2_F77NAME(zlansy)( &a1, &uplo, &n, a0.data(), &ld, work.data());
      }
      else
      {
        norm = NT2_F77NAME(zlansy)( &a1, &uplo, &n, a0.data(), &ld, 0);
      }

      return norm;
    }
Esempio n. 3
0
 BOOST_FORCEINLINE void
 combine_vects(const T1& rv, const T2& wi, A0& v)
 {
   typedef typename A0::value_type type_t;
   int n = height(rv);
   v.resize(of_size(n, n));
   nt2::container::table<type_t, nt2::shared_> sv(of_size(n, n), share(v.data(), v.data()+numel(v)));
   for(int j=1; j <= n; ++j)
   {
     if(wi(j))
     {
       sv(nt2::_, j  ) = tocomplex(rv(nt2::_, j), rv(nt2::_, j+1));
       sv(nt2::_, j+1) = conj(sv(nt2::_, j));
       ++j;
     }
     else
       sv(nt2::_, j) = rv(nt2::_, j);
   }
 }
Esempio n. 4
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;
     }
Esempio n. 5
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;
     }
Esempio n. 6
0
     BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const
     {
        result_type that;
        nt2_la_int  n  = std::min(nt2::height(a0),nt2::width(a0));
        nt2_la_int  lda = n;
        nt2_la_int  nhrs = nt2::width(a2);
        nt2_la_int  ldb = a2.leading_size();

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

        magma_zgesv(n,nhrs,(cuDoubleComplex*)a0.data(),lda,a1.data()
                   ,(cuDoubleComplex*)a2.data(),ldb,&that);

        return that;
     }
Esempio n. 7
0
    BOOST_FORCEINLINE result_type operator()(A0 const& a0, A1 const& a1) const
    {
      result_type rcond;
      nt2_la_int n = nt2::height(a0);
      nt2_la_int ld = n;
      nt2_la_int info;
      char uplo = 'L';

      nt2::memory::container<tag::table_, v_t, nt2::_2D> work(nt2::of_size(2*n,1));
      nt2::memory::container<tag::table_, result_type, nt2::_2D>  rwork(nt2::of_size(n,1));

      NT2_F77NAME(zpocon) ( &uplo, &n, a0.data(), &ld, &a1, &rcond
                          , work.data(), rwork.data(), &info
                          );

      return rcond;
    }