42 #ifndef KOKKOS_BLAS1_MP_VECTOR_HPP 
   43 #define KOKKOS_BLAS1_MP_VECTOR_HPP 
   45 #include "Sacado_ConfigDefs.h" 
   50 #include "KokkosBlas.hpp" 
   56 namespace KokkosBlas {
 
   58 #if defined(HAVE_STOKHOS_ENSEMBLE_REDUCT) 
   60 template <
typename XD, 
typename ... XP,
 
   61           typename YD, 
typename ... YP>
 
   62 typename std::enable_if<
 
   65   typename Kokkos::Details::InnerProductSpaceTraits<
 
   66     typename Kokkos::View<XD,XP...>::non_const_value_type >::dot_type
 
   68 dot(
const Kokkos::View<XD,XP...>& x,
 
   69     const Kokkos::View<YD,YP...>& y)
 
   71   typedef Kokkos::View<XD,XP...> XVector;
 
   72   typedef Kokkos::View<YD,YP...> YVector;
 
   77   return dot( x_flat, y_flat );
 
   80 template <
typename RV,
 
   81           typename XD, 
typename ... XP,
 
   82           typename YD, 
typename ... YP>
 
   83 typename std::enable_if<
 
   87     const Kokkos::View<XD,XP...>& x,
 
   88     const Kokkos::View<YD,YP...>& y)
 
   90   typedef Kokkos::View<XD,XP...> XVector;
 
   91   typedef Kokkos::View<YD,YP...> YVector;
 
   96   dot( r, x_flat, y_flat );
 
   99 template <
typename XD, 
typename ... XP>
 
  100 typename std::enable_if<
 
  102 fill(
const Kokkos::View<XD,XP...>& x,
 
  103      const typename Kokkos::View<XD,XP...>::non_const_value_type& 
val) {
 
  104   typedef Kokkos::View<XD,XP...> XVector;
 
  109      fill( x_flat, val.coeff(0) );
 
  116 template <
typename RV,
 
  117           typename XD, 
typename ... XP>
 
  118 typename std::enable_if<
 
  122   const Kokkos::View<XD,XP...>& x)
 
  124   typedef Kokkos::View<XD,XP...> XVector;
 
  131 template <
typename RV,
 
  132           typename XD, 
typename ... XP>
 
  133 typename std::enable_if<
 
  137   const Kokkos::View<XD,XP...>& x)
 
  139   typedef Kokkos::View<XD,XP...> XVector;
 
  146 template <
typename RV,
 
  147           typename XD, 
typename ... XP>
 
  148 typename std::enable_if<
 
  152   const Kokkos::View<XD,XP...>& x)
 
  154   typedef Kokkos::View<XD,XP...> XVector;
 
  161 template <
typename AV,
 
  162           typename XD, 
typename ... XP,
 
  164           typename YD, 
typename ... YP>
 
  165 typename std::enable_if<
 
  169       const Kokkos::View<XD,XP...>& x,
 
  171       const Kokkos::View<YD,YP...>& y)
 
  173   typedef Kokkos::View<XD,XP...> XVector;
 
  174   typedef Kokkos::View<YD,YP...> YVector;
 
  182   auto aa = Sacado::Value<AV>::eval(a);
 
  183   auto bb = Sacado::Value<BV>::eval(b);
 
  184   axpby( aa, x_flat, bb, y_flat );
 
  189 template <
typename RD, 
typename ... RP,
 
  190           typename XD, 
typename ... XP>
 
  191 typename std::enable_if<
 
  194 scal(
const Kokkos::View<RD,RP...>& r,
 
  195      const typename Kokkos::View<XD,XP...>::non_const_value_type& a,
 
  196      const Kokkos::View<XD,XP...>& x)
 
  198   typedef Kokkos::View<RD,RP...> RVector;
 
  199   typedef Kokkos::View<XD,XP...> XVector;
 
  207   scal( r_flat, a.coeff(0), x_flat );
 
  215 template <
typename XD, 
typename ... XP,
 
  216           typename YD, 
typename ... YP,
 
  217           typename ZD, 
typename ... ZP>
 
  218 typename std::enable_if<
 
  223   const typename Kokkos::View<XD,XP...>::array_type::non_const_value_type& alpha,
 
  224   const Kokkos::View<XD,XP...>& x,
 
  225   const typename Kokkos::View<YD,YP...>::array_type::non_const_value_type& beta,
 
  226   const Kokkos::View<YD,YP...>& y,
 
  227   const typename Kokkos::View<ZD,ZP...>::array_type::non_const_value_type& gamma,
 
  228   const Kokkos::View<ZD,ZP...>& z)
 
  230   typedef Kokkos::View<XD,XP...> XVector;
 
  231   typedef Kokkos::View<YD,YP...> YVector;
 
  232   typedef Kokkos::View<ZD,ZP...> ZVector;
 
  238   update( alpha, x_flat, beta, y_flat, gamma, z_flat);
 
  242 template <
typename XD, 
typename ... XP,
 
  243           typename YD, 
typename ... YP,
 
  244           typename ZD, 
typename ... ZP>
 
  245 typename std::enable_if<
 
  250   const typename Kokkos::View<XD,XP...>::non_const_value_type& alpha,
 
  251   const Kokkos::View<XD,XP...>& x,
 
  252   const typename Kokkos::View<YD,YP...>::non_const_value_type& beta,
 
  253   const Kokkos::View<YD,YP...>& y,
 
  254   const typename Kokkos::View<ZD,ZP...>::non_const_value_type& gamma,
 
  255   const Kokkos::View<ZD,ZP...>& z)
 
  260        "update not implemented for non-constant alpha, beta, gamma");
 
  263   update( alpha.coeff(0), x, beta.coeff(0), y, gamma.coeff(0), z );
 
  266 template <
typename RD, 
typename ... RP,
 
  267           typename XD, 
typename ... XP>
 
  268 typename std::enable_if<
 
  272   const Kokkos::View<RD,RP...>& r,
 
  273   const Kokkos::View<XD,XP...>& x)
 
  275   typedef Kokkos::View<RD,RP...> RVector;
 
  276   typedef Kokkos::View<XD,XP...> XVector;
 
  280   reciprocal( r_flat, x_flat );
 
  283 template <
typename RD, 
typename ... RP,
 
  284           typename XD, 
typename ... XP>
 
  285 typename std::enable_if<
 
  289   const Kokkos::View<RD,RP...>& r,
 
  290   const Kokkos::View<XD,XP...>& x)
 
  292   typedef Kokkos::View<RD,RP...> RVector;
 
  293   typedef Kokkos::View<XD,XP...> XVector;
 
  297   sum( r_flat, x_flat );
 
  300 template <
typename RD, 
typename ... RP,
 
  301           typename XD, 
typename ... XP,
 
  302           typename WD, 
typename ... WP>
 
  303 typename std::enable_if<
 
  308   const Kokkos::View<RD,RP...>& r,
 
  309   const Kokkos::View<XD,XP...>& x,
 
  310   const Kokkos::View<WD,WP...>& w)
 
  312   typedef Kokkos::View<RD,RP...> RVector;
 
  313   typedef Kokkos::View<XD,XP...> XVector;
 
  314   typedef Kokkos::View<WD,WP...> WVector;
 
  322 template <
typename CD, 
typename ... CP,
 
  323           typename AD, 
typename ... AP,
 
  324           typename BD, 
typename ... BP>
 
  325 typename std::enable_if<
 
  330   const typename Kokkos::View<CD,CP...>::const_value_type& c,
 
  331   const Kokkos::View<CD,CP...>& 
C,
 
  332   const typename Kokkos::View<AD,AP...>::const_value_type& ab,
 
  333   const Kokkos::View<AD,AP...>& 
A,
 
  334   const Kokkos::View<BD,BP...>& 
B)
 
  340   typedef Kokkos::View<CD,CP...> CVector;
 
  341   typedef Kokkos::View<AD,AP...> AVector;
 
  342   typedef Kokkos::View<BD,BP...> BVector;
 
  347   mult( c.coeff(0), C_flat, ab.coeff(0), A_flat, B_flat );
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value >::type fill(const Kokkos::View< XD, XP...> &x, const typename Kokkos::View< XD, XP...>::non_const_value_type &val)
 
KOKKOS_INLINE_FUNCTION void raise_error(const char *msg)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< YD, YP...> >::value, typename Kokkos::Details::InnerProductSpaceTraits< typename Kokkos::View< XD, XP...>::non_const_value_type >::dot_type >::type dot(const Kokkos::View< XD, XP...> &x, const Kokkos::View< YD, YP...> &y)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value >::type nrm1(const RV &r, const Kokkos::View< XD, XP...> &x)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< RD, RP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< WD, WP...> >::value >::type nrm2w_squared(const Kokkos::View< RD, RP...> &r, const Kokkos::View< XD, XP...> &x, const Kokkos::View< WD, WP...> &w)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value >::type nrm2_squared(const RV &r, const Kokkos::View< XD, XP...> &x)
 
KOKKOS_INLINE_FUNCTION bool is_constant(const T &x)
 
void deep_copy(const Stokhos::CrsMatrix< ValueType, DstDevice, Layout > &dst, const Stokhos::CrsMatrix< ValueType, SrcDevice, Layout > &src)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< YD, YP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< ZD, ZP...> >::value >::type update(const typename Kokkos::View< XD, XP...>::array_type::non_const_value_type &alpha, const Kokkos::View< XD, XP...> &x, const typename Kokkos::View< YD, YP...>::array_type::non_const_value_type &beta, const Kokkos::View< YD, YP...> &y, const typename Kokkos::View< ZD, ZP...>::array_type::non_const_value_type &gamma, const Kokkos::View< ZD, ZP...> &z)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value >::type nrmInf(const RV &r, const Kokkos::View< XD, XP...> &x)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< YD, YP...> >::value >::type axpby(const AV &a, const Kokkos::View< XD, XP...> &x, const BV &b, const Kokkos::View< YD, YP...> &y)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< RD, RP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value >::type scal(const Kokkos::View< RD, RP...> &r, const typename Kokkos::View< XD, XP...>::non_const_value_type &a, const Kokkos::View< XD, XP...> &x)
 
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< RD, RP...> >::value &&Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value >::type sum(const Kokkos::View< RD, RP...> &r, const Kokkos::View< XD, XP...> &x)