Esempio n. 1
0
 /// INTERNAL ONLY: 3o 3i
 BOOST_FORCEINLINE
 void eval3_3( A0& a0, A1& a1
              ,  nt2::policy<ext::vector_>  const &
              ,  nt2::policy<ext::balance_> const &
              ) const
 {
   nt2::container::table<type_t> work;
   NT2_AS_TERMINAL_INOUT(desired_semantic,  a, boost::proto::child_c<0>(a0), work);
   NT2_AS_TERMINAL_OUT  (desired_semantic, vr, boost::proto::child_c<0>(a1));
   NT2_AS_TERMINAL_OUT  (desired_semantic, vl, boost::proto::child_c<2>(a1));
   NT2_AS_TERMINAL_OUT  (desired_semantic,  w, boost::proto::child_c<1>(a1));
   nt2_la_int ilo, ihi;
   nt2_la_int n = height(a);
   nt2::container::table<rtype_t> scale(of_size(n, 1));
   NT2_LAPACK_VERIFY(gebal(boost::proto::value(a)
                          , boost::proto::value(scale)
                          , ilo, ihi, 'B'));
   tie(vr, w, vl) = nseig(a, nt2::policy<ext::vector_>(), nt2::policy<ext::no_balance_>());
   NT2_LAPACK_VERIFY(gebak(boost::proto::value(vr),
                           boost::proto::value(scale)
                          , ilo, ihi, 'B', 'R'));
   NT2_LAPACK_VERIFY(gebak(boost::proto::value(vl)
                          , boost::proto::value(scale)
                          , ilo, ihi, 'B', 'L'));
   boost::proto::child_c<1>(a1) = w;
   boost::proto::child_c<0>(a1) = vr;
   boost::proto::child_c<2>(a1) = vl;
 }
Esempio n. 2
0
  /// INTERNAL ONLY: 3o 3i
 BOOST_FORCEINLINE
 void eval3_3( A0& a0, A1& a1
              ,  nt2::policy<ext::matrix_>  const &
              ,  nt2::policy<ext::no_balance_> const &
              ) const
 {
   nt2::container::table<type_t> work;
   NT2_AS_TERMINAL_INOUT(desired_semantic,  a, boost::proto::child_c<0>(a0), work);
   NT2_AS_TERMINAL_OUT  (desired_semantic, vr, boost::proto::child_c<0>(a1));
   NT2_AS_TERMINAL_OUT  (desired_semantic, vl, boost::proto::child_c<2>(a1));
   nt2_la_int n = height(a);
   nt2::container::table<ctype_t> w(of_size(n, 1));
   tie( vr, w, vl) = nseig(a, nt2::policy<ext::vector_>());
   boost::proto::child_c<1>(a1) =  from_diag(w);
   boost::proto::child_c<0>(a1) = vr;
   boost::proto::child_c<2>(a1) = vl;
 }
Esempio n. 3
0
 /// INTERNAL ONLY: 2o 2i
  BOOST_FORCEINLINE
  void eval2_2 ( A0& a0, A1& a1
               , nt2::policy<ext::vector_> const &
               ) const
  {
    nt2::container::table<type_t> work;
    NT2_AS_TERMINAL_INOUT(desired_semantic,  a, boost::proto::child_c<0>(a0), work);
    NT2_AS_TERMINAL_OUT  (desired_semantic, vr, boost::proto::child_c<0>(a1));
    NT2_AS_TERMINAL_OUT  (desired_semantic,  w, boost::proto::child_c<1>(a1));
    size_t n = height(a);
    w.resize(of_size(n, 1));
    vr.resize(of_size(n, n));
    NT2_LAPACK_VERIFY(nt2::geev_wvr( boost::proto::value(a)
                                   , boost::proto::value(w)
                                   , boost::proto::value(vr)
                                   ));
    boost::proto::child_c<1>(a1) = w;
    boost::proto::child_c<0>(a1) = vr;
  }
Esempio n. 4
0
    ///////////////////////////////////////////////////////////////////////////////
    /// INTERNAL ONLY: 2i 3o vector_: tie(q, r, ip) = qr(a, vector_)
    BOOST_FORCEINLINE
    void eval2_3 ( A0& a0, A1& a1
                   , const nt2::policy<ext::vector_>&
                   ) const
    {
      nt2::container::table<type_t> work;
      NT2_AS_TERMINAL_INOUT(o_semantic, r
                           , boost::proto::child_c<0>(a0), work);
      NT2_AS_TERMINAL_OUT  (o_semantic, x
                           , boost::proto::child_c<0>(a1));
      NT2_AS_TERMINAL_OUT  (i_semantic, ip
                           , boost::proto::child_c<2>(a1));
      nt2::container::table<type_t>     tau;
      tie(x, tau, ip) = qr(r, nt2::raw_);

      extract_qr(x, tau, r, nt2::policy<ext::raw_>());
      assign_swap(boost::proto::child_c<0>(a1), x);
      assign_swap(boost::proto::child_c<1>(a1), r);
      assign_swap(boost::proto::child_c<2>(a1), ip);
    }
Esempio n. 5
0
 ///////////////////////////////////////////////////////////////////////////////
 /// INTERNAL ONLY: 2i 3o raw_: tie(x, tau, ip) = qr(a, nt2::raw_)
 BOOST_FORCEINLINE
 void eval2_3 ( A0& a0, A1& a1
                , const nt2::policy<ext::raw_>&
                ) const
 {
   nt2::container::table<type_t> work;
   NT2_AS_TERMINAL_INOUT(o_semantic, x
                        , boost::proto::child_c<0>(a0), boost::proto::child_c<0>(a1));
   NT2_AS_TERMINAL_OUT(o_semantic, tau
                      , boost::proto::child_c<1>(a1));
   NT2_AS_TERMINAL_OUT(i_semantic,  ip
                      , boost::proto::child_c<2>(a1));
   tau.resize(of_size(dim(x), 1));
   ip = nt2::zeros(nt2::width(x),1,nt2::meta::as_<nt2_la_int>());
   NT2_LAPACK_VERIFY(nt2::geqp3( boost::proto::value(x)
                               , boost::proto::value(ip)
                               , boost::proto::value(tau)));
   assign_swap(boost::proto::child_c<0>(a1), x);
   assign_swap(boost::proto::child_c<1>(a1), tau);
   assign_swap(boost::proto::child_c<2>(a1), ip);
 }
Esempio n. 6
0
 /// INTERNAL ONLY: 3o 2i
 BOOST_FORCEINLINE
 void eval3_2 ( A0& a0, A1& a1
              , nt2::policy<ext::matrix_> const &
              ) const
 {
   nt2::container::table<type_t> work;
   NT2_AS_TERMINAL_INOUT(desired_semantic,  a, boost::proto::child_c<0>(a0), work);
   NT2_AS_TERMINAL_OUT  (desired_semantic, vr, boost::proto::child_c<0>(a1));
   NT2_AS_TERMINAL_OUT  (desired_semantic, vl, boost::proto::child_c<2>(a1));
   size_t n = height(a);
   nt2::container::table<ctype_t> w(of_size(n, 1));
   vr.resize(of_size(n, n));
   vl.resize(of_size(n, n));
   NT2_LAPACK_VERIFY(nt2::geev_wvrvl( boost::proto::value(a)
                                    , boost::proto::value(w)
                                    , boost::proto::value(vr)
                                    , boost::proto::value(vl)
                                    ));
   boost::proto::child_c<1>(a1) = from_diag(w);
   boost::proto::child_c<0>(a1) = vr;
   boost::proto::child_c<2>(a1) = vl;
 }
Esempio n. 7
0
 ///////////////////////////////////////////////////////////////////////////////
 /// INTERNAL ONLY: 2i 2o raw_: tie(x, tau) = qr(a, raw_)
 BOOST_FORCEINLINE
 void eval2_2 ( A0& a0, A1& a1
                , const nt2::policy<ext::raw_>&
                ) const
 {
   NT2_AS_TERMINAL_INOUT(o_semantic, x
                        , boost::proto::child_c<0>(a0), boost::proto::child_c<0>(a1));
   NT2_AS_TERMINAL_OUT(o_semantic, tau
                      , boost::proto::child_c<1>(a1));
   tau.resize(of_size(dim(x), 1));
   NT2_LAPACK_VERIFY(nt2::geqrf( boost::proto::value(x)
                               , boost::proto::value(tau)));
   assign_swap(boost::proto::child_c<0>(a1), x);
   assign_swap(boost::proto::child_c<1>(a1), tau);
 }
Esempio n. 8
0
 BOOST_FORCEINLINE
 void eval2_2 ( A0& a0, A1& a1
              , const T&
              ) const
 {
   nt2::container::table<type_t> work;
   NT2_AS_TERMINAL_INOUT(o_semantic
                        , r, boost::proto::child_c<0>(a0), work);
   NT2_AS_TERMINAL_OUT  (o_semantic
                        , x, boost::proto::child_c<0>(a1));
   nt2::container::table<type_t>     tau;
   tie(x, tau) = qr(r, nt2::raw_);
   extract_qr(x, tau, r, T()); // extract raw or econ
   assign_swap(boost::proto::child_c<0>(a1), x);
   assign_swap(boost::proto::child_c<1>(a1), r);
 }
Esempio n. 9
0
    ///////////////////////////////////////////////////////////////////////////////
    /// INTERNAL ONLY: 1i 2o raw_
    BOOST_FORCEINLINE
    void eval1_2 ( A0& a0, A1& a1
                   , const nt2::policy<ext::raw_>&
                   ) const
    {
      typedef nt2::memory::container<tag::table_, nt2_la_int, nt2::_2D> i_semantic;
      NT2_AS_TERMINAL_INOUT(o_semantic
                           , lu, boost::proto::child_c<0>(a0)
                           , boost::proto::child_c<0>(a1));
      NT2_AS_TERMINAL_OUT(i_semantic, ls
                         , boost::proto::child_c<1>(a1));

      ls.resize(of_size(dim(lu), 1));
      CHECK_LAPACK_LU_SUCCESS(nt2::getrf( boost::proto::value(lu)
                                        , boost::proto::value(ls)));
      assign_swap(boost::proto::child_c<0>(a1), lu);
      assign_swap(boost::proto::child_c<1>(a1), ls);
    }
Esempio n. 10
0
     ///////////////////////////////////////////////////////////////////////////////
    /// INTERNAL ONLY: 2i 3o matrix_: tie(q, r, p) = qr(a, matrix_)
    BOOST_FORCEINLINE
    void eval2_3 ( A0& a0, A1& a1
                   , const nt2::policy<ext::matrix_>&
                   ) const
    {
      nt2::container::table<type_t> work;
      NT2_AS_TERMINAL_INOUT(o_semantic, r
                           , boost::proto::child_c<0>(a0), work);
      NT2_AS_TERMINAL_OUT  (o_semantic, x
                           , boost::proto::child_c<0>(a1));
      nt2::container::table<type_t>     tau;
      nt2::container::table<nt2_la_int>  ip;
      tie(x, tau, ip) = qr(r, nt2::raw_);

      extract_qr(x, tau, r, nt2::policy<ext::raw_>());
      assign_swap(boost::proto::child_c<0>(a1), x);
      assign_swap(boost::proto::child_c<1>(a1), r);
      boost::proto::child_c<2>(a1) = eye(numel(ip), nt2::meta::as_<type_t>())(nt2::_, ip);
    }