예제 #1
0
파일: getrf.hpp 프로젝트: aminiussi/nt2
     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;
     }
예제 #2
0
파일: posv.hpp 프로젝트: JanVogelgesang/nt2
     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;
     }
예제 #3
0
파일: gesv.hpp 프로젝트: aminiussi/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.data(),lda,a1.data()
                   ,(cuDoubleComplex*)a2.data(),ldb,&that);

        return that;
     }
예제 #4
0
파일: nearest.hpp 프로젝트: kevinushey/nt2
    result_type operator()(A0& yi, A1& inputs) const
    {
        yi.resize(inputs.extent());
        const child0 & x   =  boost::proto::child_c<0>(inputs);
        if (numel(x) <=  1)
            BOOST_ASSERT_MSG(numel(x) >  1, "Interpolation requires at least two sample points in each dimension.");
        else
        {
            BOOST_ASSERT_MSG(issorted(x, 'a'), "for 'nearest' interpolation x values must be sorted in ascending order");
            const child1 & y   =  boost::proto::child_c<1>(inputs);
            BOOST_ASSERT_MSG(numel(x) == numel(y), "The grid vectors do not define a grid of points that match the given values.");
            const child2 & xi  =  boost::proto::child_c<2>(inputs);
            bool extrap = false;
            value_type extrapval = Nan<value_type>();
            choices(inputs, extrap, extrapval, N1());
            table<index_type>   index = bsearch (x, xi);
            table<value_type>  dx    =  xi-x(index);
            table<index_type> indexp1 =  oneplus(index);
            yi = y(nt2::if_else(lt(nt2::abs(xi-x(index)), nt2::abs(xi-x(indexp1))), index,  indexp1));
            value_type  b =  value_type(x(begin_));
            value_type  e =  value_type(x(end_));
            if (!extrap) yi = nt2::if_else(nt2::logical_or(boost::simd::is_nge(xi, b),
                                               boost::simd::is_nle(xi, e)), extrapval, yi);
        }

        return yi;
    }
예제 #5
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;
 }
예제 #6
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;
 }
예제 #7
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;
    }
예제 #8
0
파일: mqr.hpp 프로젝트: gilbert0571/nt2
     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;
     }
예제 #9
0
파일: gqr.hpp 프로젝트: gilbert0571/nt2
     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();
        nt2_la_int  k  = a1.leading_size();

        details::workspace<typename A0::value_type> w;

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

        w.prepare_main();
        nt2::gqr(a0,a1,w);

        return that;
     }
예제 #10
0
파일: run.hpp 프로젝트: KWMalik/nt2
    BOOST_FORCEINLINE result_type
    operator()(A0& a0, A1& a1) const
    {
      a0.resize(a1.extent());

      input_type input = boost::proto::child_c<0>(a1);
      extent_type ext = input.extent();
      std::size_t dim = nt2::ndims(ext);
      std::size_t red = reduction_dim(a1, boost::mpl::bool_<!(boost::proto::arity_of<A1>::value <= 1)>());

#if 0
      if((red - 1 < ext.size() && ext[red-1] == 1) || ext.size() < red)
        return nt2::run_assign(a0, input);
#endif

      if(dim == 1 && red == 1)
      {
        nt2::run( a0, 0u
                , nt2::fold( input
                           , typename nt2::make_functor<Neutral1, A0>::type()
                           , typename nt2::make_functor<O1, A0>::type()
                           , typename nt2::make_functor<T1, A0>::type()
                           )
                );

      }
      else if(red == 1)
      {
        nt2::inner_fold( a0
                       , input
                       , typename nt2::make_functor<Neutral1, A0>::type()
                       , typename nt2::make_functor<O1, A0>::type()
                       , typename nt2::make_functor<T1, A0>::type()
                       );
      }
#if 0
      else if(red == ext.size())
      {
        nt2::outer_fold( a0
                       , input
                       , typename nt2::make_functor<Neutral1, A0>::type()
                       , typename nt2::make_functor<O1, A0>::type()
                       , typename nt2::make_functor<T1, A0>::type()
                       );
      }
#endif
      else
      {
        std::size_t inner = red-1 < ext.size() ? ext[red-1] : 1;

        std::size_t lo = std::accumulate( ext.begin()
                                        , ext.begin()+std::min(red-1, dim)
                                        , std::size_t(1)
                                        , std::multiplies<std::size_t>()
                                        );

        std::size_t hi = std::accumulate( ext.begin()+std::min(red, dim)
                                        , ext.begin()+dim
                                        , std::size_t(1)
                                        , std::multiplies<std::size_t>()
                                        );

        nt2::partial_fold( reshape(a0, of_size(lo, hi))
                         , reshape(input, of_size(lo, inner, hi))
                         , typename nt2::make_functor<Neutral1, A0>::type()
                         , typename nt2::make_functor<O1, A0>::type()
                         , typename nt2::make_functor<T1, A0>::type()
                         );
      }

      return a0;
    }
예제 #11
0
파일: new.hpp 프로젝트: 00liujj/dealii
 static RT
 eval(Env const& env, A0& _0, A1& _1)
 {
     return new T(_0.eval(env), _1.eval(env));
 }
예제 #12
0
 R operator () ( const F &f, const A1 &l ) const {
     return f( l.x(), l.y() );
 }
예제 #13
0
파일: pr64612.C 프로젝트: 0day-ci/gcc
void
F::addMatch (const QString &&)
{
  m_matchingMimeTypes.clear ();
}