예제 #1
0
파일: combine.hpp 프로젝트: gilbert0571/nt2
 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.raw(), w.raw()+n));
   sw = tocomplex(wr, wi);
 }
예제 #2
0
    static type call(A0& a0, I const& indices)
    {
      Idx idx = nt2::function_index(indices, a0.extent(), meta::as_<typename A0::indexes_type>());
      std::size_t b = nt2::run(idx, 0u, meta::as_<std::size_t>());
      std::size_t e = nt2::run(idx, nt2::numel(idx.extent())-1u, meta::as_<std::size_t>())+1u;
      typename A0::value_type* p = const_cast<typename A0::value_type*>(a0.raw());

      return type(expr::make(container_ref(boost::make_shared<container>(idx.extent(), nt2::share(p+b, p+e)))));
    }
예제 #3
0
파일: lansy.hpp 프로젝트: atyuwen/nt2
    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.raw(), &ld, work.raw());
      }
      else
      {
        norm = NT2_F77NAME(zlansy)( &a1, &uplo, &n, a0.raw(), &ld, 0);
      }

      return norm;
    }
예제 #4
0
파일: potrf.hpp 프로젝트: LuisBL/pythran
     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;
     }
예제 #5
0
파일: potrf.hpp 프로젝트: atyuwen/nt2
     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;
     }
예제 #6
0
파일: combine.hpp 프로젝트: gilbert0571/nt2
 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.raw(), v.raw()+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);
   }
 }
예제 #7
0
파일: gebal.hpp 프로젝트: gilbert0571/nt2
 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;
 }
예제 #8
0
파일: gesv.hpp 프로젝트: gilbert0571/nt2
     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.raw(),lda,a1.raw()
                   ,(cuDoubleComplex*)a2.raw(),ldb,&that);

        return that;
     }
예제 #9
0
파일: sycon.hpp 프로젝트: atyuwen/nt2
    BOOST_FORCEINLINE result_type operator()(A0 const& a0, A1 const&a1, A2 const& a2) 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_F77NAME(zsycon) ( &uplo, &n, a0.raw(), &ld, a1.raw(), &a2, &rcond
                          , work.raw(), &info
                          );

      return rcond;
    }