43 #ifndef RTOPPACK_TOP_RANDOMIZE_HPP
44 #define RTOPPACK_TOP_RANDOMIZE_HPP
46 #include "RTOpPack_RTOpTHelpers.hpp"
64 template<
class Scalar>
103 validate_apply_op<Scalar>(*
this, 0, 1,
false,
104 sub_vecs, targ_sub_vecs, reduct_obj_inout.
getConst());
107 (void)reduct_obj_inout;
110 const index_type subDim = targ_sub_vecs[0].subDim();
111 const index_type globalOffset = targ_sub_vecs[0].globalOffset();
113 iter_t z0_val = targ_sub_vecs[0].values().begin();
114 const ptrdiff_t z0_s = targ_sub_vecs[0].stride();
117 const Scalar a = Scalar(0.5)*(
u_ -
l_);
118 const Scalar b = Scalar(0.5)*(
u_ +
l_);
119 for(
index_type i = 0; i < subDim; ++i, z0_val += z0_s )
135 template<
class Scalar>
142 #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()