/// 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 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: 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; }
tab_t pinv(base_t epsi = -1 )const { epsi = epsi < 0 ? nt2::eps(w_(1)) : epsi; tab_t w1 = nt2::if_else( gt(w_, length(a_)*epsi), nt2::rec(w_), Zero<base_t>()); return mtimes(trans(vt_), mtimes(from_diag(w1), trans(u_))); }
template<class XPR> result_type solve(const XPR & b, base_t epsi = Mone<base_t>() )const{ epsi = epsi < 0 ? nt2::eps(w_(1)) : epsi; tab_t w1 = nt2::if_else( gt(w_, length(a_)*epsi), nt2::rec(w_), Zero<base_t>()); return mtimes(trans(vt_), mtimes(from_diag(w1), mtimes(trans(u_), b))); }
//========================================================================== // Return singular values as a diagonal matrix //========================================================================== btab_t w() const { return nt2::expand(from_diag(w_), ucol_, height(vt_)); }
w_result w () const { return from_diag(w_);}
result_type w () const { return from_diag(w);}