11 #ifndef RTOPPACK_TOP_RANDOMIZE_HPP
12 #define RTOPPACK_TOP_RANDOMIZE_HPP
14 #include "RTOpPack_RTOpTHelpers.hpp"
32 template<
class Scalar>
71 validate_apply_op<Scalar>(*
this, 0, 1,
false,
72 sub_vecs, targ_sub_vecs, reduct_obj_inout.
getConst());
75 (void)reduct_obj_inout;
78 const index_type subDim = targ_sub_vecs[0].subDim();
79 const index_type globalOffset = targ_sub_vecs[0].globalOffset();
81 iter_t z0_val = targ_sub_vecs[0].values().begin();
82 const ptrdiff_t z0_s = targ_sub_vecs[0].stride();
85 const Scalar a = Scalar(0.5)*(
u_ -
l_);
86 const Scalar b = Scalar(0.5)*(
u_ +
l_);
87 for(
index_type i = 0; i < subDim; ++i, z0_val += z0_s )
103 template<
class Scalar>
110 #endif // RTOPPACK_TOP_RANDOMIZE_HPP
Class for a changeable sub-vector.
void set_bounds(const Scalar &l, const Scalar &u)
unsigned int get_seed() const
static unsigned int static_seed_
Teuchos_Ordinal index_type
Class for a non-changeable sub-vector.
Templated interface to vector reduction/transformation operators {abstract}.
Generate a random vector in the range [l,u]: z0[i] = 0.5*((u-l)*Teuchos::ScalarTraits<Scalar>::random...
TOpRandomize(const Scalar &l=-ScalarTraits< Scalar >::one(), const Scalar &u=+ScalarTraits< Scalar >::one())
static void seedrandom(unsigned int s)
void setOpNameBase(const std::string &op_name_base)
Just set the operator name.
static void set_static_seed(const unsigned int static_seed)
void apply_op_impl(const ArrayView< const ConstSubVectorView< Scalar > > &sub_vecs, const ArrayView< const SubVectorView< Scalar > > &targ_sub_vecs, const Ptr< ReductTarget > &reduct_obj_inout) const
Ptr< const T > getConst() const
void set_seed(const unsigned int seed)
static unsigned int get_static_seed()