Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Kokkos_Random_MP_Vector.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef KOKKOS_RANDOM_MP_VECTOR_HPP
11 #define KOKKOS_RANDOM_MP_VECTOR_HPP
12 
13 #include "Stokhos_ConfigDefs.h"
14 #if defined(HAVE_STOKHOS_KOKKOS)
15 
16 #include "Sacado_MP_Vector.hpp"
18 #include "Kokkos_Random.hpp"
19 
20 //----------------------------------------------------------------------------
21 // Specializations of Kokkos random functions for Sacado::MP::Vector scalar type
22 //----------------------------------------------------------------------------
23 
24 namespace Kokkos {
25 
26  template<class Generator, class Storage>
27  struct rand<Generator,Sacado::MP::Vector<Storage> > {
29  typedef typename Scalar::value_type BaseScalar;
30  typedef rand<Generator,BaseScalar> BaseRand;
31 
32  KOKKOS_INLINE_FUNCTION
33  static Scalar max() { return BaseRand::max(); }
34 
35  KOKKOS_INLINE_FUNCTION
36  static Scalar draw(Generator& gen) {
37  return BaseRand::draw(gen);
38  }
39 
40  KOKKOS_INLINE_FUNCTION
41  static Scalar draw(Generator& gen, const Scalar& range) {
42  return BaseRand::draw(gen, range.coeff(0));
43  }
44 
45  KOKKOS_INLINE_FUNCTION
46  static Scalar draw(Generator& gen, const Scalar& start, const Scalar& end) {
47  return BaseRand::draw(gen, start.coeff(0), end.coeff(0));
48  }
49  };
50 
51 }
52 
53 #endif
54 
55 #endif /* #ifndef KOKKOS_RANDOM_MP_VECTOR_HPP */
KOKKOS_INLINE_FUNCTION PCE< Storage > max(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)