svd_result ( Input& xpr, char jobu, char jobvt) : jobu_(jobu) , jobvt_(jobvt) , a_(xpr) , aa_(xpr) , m_( nt2::height(xpr) ) , n_( nt2::width(xpr) ) , lda_( a_.leading_size() ) , info_(0) { BOOST_ASSERT_MSG((jobvt_ != 'O' || jobu_ != 'O'), "jobu and jobvt cannot be 'O' simultaneously"); ldu_ = (jobu_== 'N') ? 1 : m_; ucol_ = (jobu_== 'S'||jobu_== 'O') ? nt2::min(n_, m_) : ((jobu_== 'N') ? 1 : m_); vtcol_ = (jobvt_== 'N') ? 1 : n_; ldvt_ = (jobvt_== 'S'||jobvt_== 'O') ? nt2::min(n_, m_) : ((jobvt_== 'N') ? 1 : n_); u_.resize(of_size(ldu_, ucol_)); ldu_ = u_.leading_size(); vt_.resize(of_size(ldvt_, vtcol_)); ldvt_ = vt_.leading_size(); w_.resize(of_size(nt2::min(n_, m_), 1)); nt2::details::gesvd(&jobu_, &jobvt_, &m_, &n_, aa_.raw(), &lda_, w_.raw(), u_.raw(), &ldu_, vt_.raw(), &ldvt_, &info_, wrk_); }
balance_result ( Input& xpr, char job/* = 'B'*/) : job_(job) , a_(xpr) , aa_(xpr) , ipi_(of_size(0, 0)) , n_( nt2::height(a_) ) , lda_( a_.leading_size() ) , t_(of_size(n_, n_)) , invt_(of_size(0, 0)) , ilo_(0) , ihi_(0) , scale_(of_size(1, n_)) , info_(0) { BOOST_ASSERT_MSG(issquare(aa_), "matrix to balance must be square"); nt2::details::gebal(&job_, &n_, aa_.raw(), &lda_, &ilo_, &ihi_, scale_.raw(), &info_); t_ = nt2::eye(n_, n_, meta::as_<type_t>()); nt2_la_int ldt = t_.leading_size(); char side = 'R'; nt2::details::gebak(&job_, &side, &n_, &ilo_, &ihi_, scale_.raw(), &n_, t_.raw(), &ldt, &info_); }
static tab_t getpadecoefficients(const size_t & m) { // getpadecoefficients coefficients of numerator p of pade approximant // c = getpadecoefficients returns coefficients of numerator // of [m/m] pade approximant, where m = 3,5,7,9,13. const T m3[] = {T(120), T(60), T(12), T(1)}; const T m5[] = {T(30240), T(15120), T(3360), T(420), T(30), T(1)}; const T m7[] = {T(17297280), T(8648640), T(1995840), T(277200), T(25200), T(1512), T(56), T(1)}; const T m9[] = {T(17643225600), T(8821612800), T(2075673600), T(302702400), T(30270240), T(2162160), T(110880), T(3960), T(90), T(1)}; const T m13[] = {T(64764752532480000), T(32382376266240000), T(7771770303897600), T(1187353796428800), T(129060195264000), T(10559470521600), T(670442572800), T(33522128640), T(1323241920), T(40840800), T(960960), T(16380), T(182), T(1)}; static tab_t v; switch (m) { case 3: v = tab_t(of_size(4, 1), &m3[0], &m3[0]+4); return v; case 5: v = tab_t(of_size(6, 1), &m5[0], &m5[0]+6); return v; case 7: v = tab_t(of_size(8, 1), &m7[0], &m7[0]+8); return v; case 9: v = tab_t(of_size(10, 1), &m9[0], &m9[0]+10); return v; case 13:v = tab_t(of_size(14, 1), &m13[0], &m13[0]+14); return v; } v = nt2::zeros(0, 1, meta::as_<T>()); return v; }
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); }
result_type operator()(A0& out, const A1& in) const { size_t n = boost::proto::child_c<0>(in); value_type fn = value_type(n); table<value_type> ns = nt2::cons(of_size(1, 3), fn, fn/12, fn/20); table<i_type> ee(nt2::of_size(1, 3)); table<value_type> ff(nt2::of_size(1, 3)); // nt2::frexp(ns, ff, ee); nt2::frexp(ns(1), ff(1), ee(1)); nt2::frexp(ns(2), ff(2), ee(2)); nt2::frexp(ns(3), ff(3), ee(3)); BOOST_AUTO_TPL(kk, nt2::find(nt2::logical_and(eq(ff, nt2::Half<value_type>()), is_gtz(ee)))); BOOST_ASSERT_MSG(!nt2::isempty(kk), "n must be of form 2^m or 12*2^m or 20*2^m"); size_t k = kk(1); i_type e = nt2::minusone(ee(k)); out.resize(nt2::of_size(n, n)); table<value_type> h; if (k == 1) // n = 1 * 2^e; { h = nt2::One<value_type>(); } else if ( k == 2) // N = 12 * 2^e; { h = nt2::vertcat(nt2::ones(1,12,meta::as_<value_type>()), nt2::horzcat(nt2::ones(11,1,meta::as_<value_type>()), nt2::toeplitz(cons<value_type>(of_size(1, 11), -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1), cons<value_type>(of_size(1, 11), -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1) ) ) ); } else if ( k == 3) // N = 20 * 2^e; { h = vertcat(nt2::ones(1,20,meta::as_<value_type>()), nt2::horzcat(nt2::ones(19,1,meta::as_<value_type>()), nt2::hankel(cons<value_type>(of_size(1, 19),-1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1), cons<value_type>(of_size(1, 19),1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1) ) ) ); } // Kronecker product construction. for (i_type i = 1; i <= e; ++i) { table<value_type> h1 = nt2::vertcat(nt2::horzcat(h, h), nt2::horzcat(h, -h)); h = h1; //ALIASING } out = h; return out; }
/// 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; }
svd_solve_result(Input& a, const B& b, const rtype_t & rcond = rtype_t(-1)) : a_(a) { const nt2_la_int ml = size(a_, 1); const nt2_la_int nl = size(a_, 2); const nt2_la_int nrhs = size(b, 2); const nt2_la_int lda = a_.leading_size(); // const nt2_la_int ldb = b.leading_size(); rtab_t s(of_size(nt2::min(ml, nl), 1)); // typically is a non-square, so we need to create tmp x because is // x is n x nrhs, while b is m x nrhs. we need to make copies of // these so that the routine won't corrupt data around x and b if (ml != nl) { nt2_la_int mm = std::max(std::max(ml,nl),1); x_ = nt2::expand(b, nt2::of_size(mm, nrhs)); nt2_la_int ldx_ = x_.leading_size(); nt2::details::gelsd(&ml, &nl, &nrhs, a_.raw(), &lda, x_.raw(), &ldx_, s.raw(), &rcond, &rank_, &info_); x_ = x_(_(1, nl), _(1, nrhs)); // BOOST_ASSERT_MSG(info!= 0, "lapack error : gelsd in solve_svd_ip(1)"); } else { x_ = b; nt2_la_int ldx_ = x_.leading_size(); nt2::details::gelsd(&ml, &nl, &nrhs, a_.raw(), &lda, x_.raw(), &ldx_, s.raw(), &rcond, &rank_, &info_); // BOOST_ASSERT_MSG(info == 0, "lapack error : gelsd in solve_svd_ip(2)"); } }
template<class TAG, class F, class X> BOOST_FORCEINLINE typename details::integration<F, X, TAG>::result_type primitive(F f, X x) { typedef details::integration<F, X, TAG> i_t; typedef typename i_t::input_t input_t; typedef typename i_t::result_t result_t; typedef typename i_t::real_t real_t; typedef container::table<input_t> itab_t; typedef container::table<result_t> rtab_t; typedef typename details::h2_t<input_t>::ab_t ab_t; typedef typename i_t::result_type result_type; size_t nbres = nt2::numel(x); rtab_t res(of_size(1, nbres)); real_t err = Zero<real_t>(); size_t warn = 0; size_t fcnt = 0; if (numel(x) == 0) { result_type r = { nt2::zeros(nt2::of_size(1, 0)), err, 0, true, 0}; return r; } res(1) = nt2::Zero<result_t>(); for(size_t i=2; i <= nbres; i++) { BOOST_AUTO_TPL(r, (details::integration<F, ab_t, TAG>::call(f, nt2::cath(x(i-1), x(i))))); res(i) = res(i-1)+r.integrals(end_); err = nt2::max(err, r.errors); warn = nt2::max(warn, r.warning); fcnt += r.eval_count; } result_type r = { res, err, fcnt, warn == 0, warn}; return r; }
BOOST_FORCEINLINE void inverse(T1& ip) const { T1 inv(of_size(1, numel(ip))); inv(ip) = nt2::_(nt2_la_int(1), nt2_la_int(numel(ip))); assign_swap(ip, inv); }
schur_result ( Input& xpr , char jobvs/* = 'V'*/ , char sort /* = 'N'*/ , char sense/* = 'N'*/) : jobvs_(jobvs) , sort_(sort) , sense_(sense) , a_(xpr) , aa_(xpr) , n_(nt2::height(xpr)) , lda_(a_.leading_size()) { BOOST_ASSERT_MSG(issquare(aa_), "Error using schur. Matrix must be square."); jobvs_ = (sense_ == 'E' || sense_ == 'B') ? 'V':jobvs_; sort_ = (sense_ == 'E') ? 'S' : sort_; ldvs_ = (jobvs_ == 'V') ? n_ : 1; w_.resize(nt2::of_size(n_, 1)); vs_.resize(of_size(ldvs_, ldvs_)); ldvs_ = vs_.leading_size(); nt2::details::geesx(&jobvs_, &sort_, &nt2::details::selectall , &sense_, &n_, aa_.raw(), &lda_, &sdim_, w_.raw(), vs_.raw(), &ldvs_, &rconde_, &rcondv_, &info_, wrk_); }
static const rtab_t& c1() { static const real_t alpha = nt2::Sqrt_2o_3<real_t>(); static const real_t beta = nt2::Sqrt_1o_5<real_t>(); static const real_t cc1[] = {-alpha, -beta, Zero<real_t>(), beta, alpha}; static const rtab_t c(of_size(1, 5), &cc1[0], &cc1[5]); return c; }
/// INTERNAL ONLY: 2o 2i BOOST_FORCEINLINE void eval2_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)); size_t n = height(a); nt2::container::table<ctype_t> w(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) = from_diag(w); boost::proto::child_c<0>(a1) = vr; }
static const tab_t& theta(const float&){ static const float theta_[] = { 4.258730016922831e-001f, //m_vals = 3 1.880152677804762e+000f, //m_vals = 5 3.925724783138660e+000f //m_vals = 7 }; static const tab_t v( of_size(3, 1), &theta_[0], &theta_[0]+3); return v; }
BOOST_FORCEINLINE result_type operator()(A0 const& l, A0 const & u, A1 const &n, A2 const &) const { return boost::proto:: make_expr < nt2::tag::logspace_ , container::domain > ( boxify(of_size(1,n)) , boxify(nt2::details::logspace<A0>(l,u,n)) , meta::as_<A0>() ); }
ldl_result ( char uplo/* = 'U'*/ , Input& xpr , typename boost:: disable_if_c<boost::is_same<ldl_result,Input>::value>::type* = 0 ) : uplo_(uplo == 'L' ? 'L':'U') , a_(xpr) , ldl_(xpr) , n_( nt2::width(xpr) ) , ldldl_( ldl_.leading_size() ) , ipiv_(nt2::of_size(n_, 1)) , info_(0) , p_(of_size(0, 1)) , ip_(of_size(0, 1)) , pl_(of_size(0, 1)) , invt_(of_size(0, 1)) { nt2::details::hstrf(&uplo_, &n_, ldl_.raw(), &ldldl_, ipiv_.raw(), &info_, w_); }
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); } }
BOOST_FORCEINLINE result_type operator()(A0 const& l, A0 const& s, A0 const& u) const { std::size_t n = (s) ?((u>l)? ((u-l+s)/s) : 0) : u; return boost::proto::make_expr< nt2::tag::colon_ , container::domain > ( boxify(of_size(1,n)) , boxify(nt2::details::colon<A0>(l,s)) , meta::as_<A0>() ); }
static const tab_t& theta(const double&){ static const double theta_[] = { 1.495585217958292e-002,// m_vals = 3 2.539398330063230e-001,// m_vals = 5 9.504178996162932e-001,// m_vals = 7 2.097847961257068e+000,// m_vals = 9 5.371920351148152e+000 // m_vals = 13 }; static const tab_t v( of_size(5, 1),&theta_[0], &theta_[0]+5); return v; }
/////////////////////////////////////////////////////////////////////////////// /// INTERNAL ONLY: 1i 1o: x = qr(a) BOOST_FORCEINLINE void eval1_1 ( A0& a0, A1& a1 , const nt2::policy<ext::raw_>& ) const { NT2_AS_TERMINAL_INOUT(o_semantic, r , boost::proto::child_c<0>(a0), boost::proto::child_c<0>(a1)); o_semantic tau(of_size(height(r), 1)); NT2_LAPACK_VERIFY(nt2::geqrf( boost::proto::value(r) , tau)); assign_swap(boost::proto::child_c<0>(a1), r); }
rref_result ( Input& xpr, base_t tol) : tol_(tol) , a_(xpr) , n_( nt2::height(a_) ) , m_( nt2::width(a_) ) , jb_(of_size(1, n_)) { BOOST_ASSERT_MSG(ismatrix(a_), "input to rref must be matrix"); if (tol < Zero<type_t>()) tol = nt2::max(m_,n_)*nt2::Eps<base_t>()*nt2::norm(a_,'I'); itype_t i = 1, j = 1; itype_t k = 0; type_t p; itype_t cnt = 1; while(i <= m_ && j <= n_) { // tie(p, k) = nt2::max(nt2::abs(a_(_(i, m_),j))); //TODO p = nt2::max(nt2::abs(a_(_(i, m_),j)))(1); for(int l = i; l <= m_; ++l) if (nt2::abs(a_(l, j)) == p) { k = l; break; } //k = k+i-1; if (p <= tol) { // the column is negligible, zero it out. a_(_(i, m_),j) = nt2::zeros(m_-i+1, 1, meta::as_<type_t>()); ++j; } else { // remember column index //jb_ = cath(jb_, j); //TODO jb_(cnt) = j; ++cnt; // swap i-th and k-th rows. tab_t tmp = a_(i, _(j, n_)); a_(i, _(j, n_)) = a_(k, _(j, n_)); a_(k, _(j, n_)) = tmp; // a_(cath(i, k),_(j, n)) = a_(cath(k, i),_(j, n)); // divide the pivot row by the pivot element. type_t tmp1 = a_(i, j); a_(i,_(j, n_)) = a_(i,_(j, n_))/tmp1; // subtract multiples of the pivot row from all the other rows. for (itype_t kk = 1; kk <= m_; ++kk)//[1:i-1 i+1:m] { if (kk!=i) { type_t tmp2 = a_(kk,j); a_(kk,_(j, n_)) = a_(kk,_(j, n_))- tmp2*a_(i,_(j, n_)); } } ++i; ++j; } } jb_ = nt2::expand(jb_, 1, --cnt); }
/// INTERNAL ONLY: 1o 2i BOOST_FORCEINLINE void eval1_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, w, boost::proto::child_c<0>(a1)); w.resize(of_size(height(a), 1)); NT2_LAPACK_VERIFY(nt2::geev_w( boost::proto::value(a) , boost::proto::value(w))); boost::proto::child_c<0>(a1) = w; }
/////////////////////////////////////////////////////////////////////////////// /// INTERNAL ONLY: 1i 1o raw_ BOOST_FORCEINLINE void eval1_1 ( A0& a0, A1& a1 , const nt2::policy<ext::raw_>& ) const { NT2_AS_TERMINAL_INOUT(o_semantic , lu, boost::proto::child_c<0>(a0) , boost::proto::child_c<0>(a1)); nt2::container::table<nt2_la_int> ls(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); }
/// INTERNAL ONLY: 2i 1o upper_: x = qr(a, upper_) BOOST_FORCEINLINE void eval2_1 ( A0& a0, A1& a1 , const nt2::policy<ext::upper_>& ) const { nt2::container::table<type_t> work; NT2_AS_TERMINAL_INOUT(o_semantic , r, boost::proto::child_c<0>(a0), work); o_semantic tau(of_size(height(r), 1)); NT2_LAPACK_VERIFY(nt2::geqrf( boost::proto::value(r) ,tau)); boost::proto::child_c<0>(a1) = triu(r); }
/// INTERNAL ONLY: 1o 2i BOOST_FORCEINLINE void eval1_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::container::table <ctype_t, _2D > w(of_size(height(a), 1)); NT2_LAPACK_VERIFY(nt2::geev_w( boost::proto::value(a) , boost::proto::value(w) )); boost::proto::child_c<0>(a1) = from_diag(w); //from_diag doesnt support aliasing currently }
/// INTERNAL ONLY: 3o 2i BOOST_FORCEINLINE void eval3_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)); NT2_AS_TERMINAL_OUT (desired_semantic, vl, boost::proto::child_c<2>(a1)); size_t n = height(a); vr.resize(of_size(n, n)); vl.resize(of_size(n, n)); w.resize(of_size(n, 1)); 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) = w; boost::proto::child_c<0>(a1) = vr; boost::proto::child_c<2>(a1) = vl; }
/////////////////////////////////////////////////////////////////////////////// /// 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); }
/////////////////////////////////////////////////////////////////////////////// /// INTERNAL ONLY: 2i 3o 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, lu , boost::proto::child_c<0>(a0), work); std::size_t d = dim(lu); nt2::container::table<nt2_la_int> ls(of_size(d, 1)), ip; CHECK_LAPACK_LU_SUCCESS(nt2::getrf( boost::proto::value(lu) , boost::proto::value(ls))); construct_ip(ls, ip, height(lu)); boost::proto::child_c<1>(a1) = nt2::triu(lu( nt2::_(1, d), nt2::_) ); boost::proto::child_c<0>(a1) = nt2::tri1l(lu(nt2::_, nt2::_(1, d) ) ); boost::proto::child_c<2>(a1) = eye(height(lu), nt2::meta::as_<rtype_t>())(nt2::_, ip); }
BOOST_FORCEINLINE void eval1_2 ( A0& a0, A1& a1 , const T & ) const { NT2_AS_TERMINAL_INOUT(o_semantic, lu , boost::proto::child_c<0>(a0) , boost::proto::child_c<1>(a1)); std::size_t d = dim(lu); nt2::container::table<nt2_la_int> ls(of_size(d, 1)); CHECK_LAPACK_LU_SUCCESS(nt2::getrf( boost::proto::value(lu) , boost::proto::value(ls))); nt2::container::table<nt2_la_int> ip; construct_ip(ls, ip, height(lu)); boost::proto::child_c<0>(a1) = nt2::tri1l(lu(nt2::_, nt2::_(1, d) ) )(ip, nt2::_); boost::proto::child_c<1>(a1) = nt2::triu(lu( nt2::_(1, d), nt2::_) ); }
/// 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; }
/////////////////////////////////////////////////////////////////////////////// /// 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); }