RTOp Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
RTOpPack::TOpRandomize< Scalar > Class Template Reference

Generate a random vector in the range [l,u]: z0[i] = 0.5*((u-l)*Teuchos::ScalarTraits<Scalar>::random()+(u+l)), i=0...n-1. More...

#include <RTOpPack_TOpRandomize.hpp>

Inheritance diagram for RTOpPack::TOpRandomize< Scalar >:
Inheritance graph
[legend]

Public Member Functions

 TOpRandomize (const Scalar &l=-ScalarTraits< Scalar >::one(), const Scalar &u=+ScalarTraits< Scalar >::one())
 
void set_bounds (const Scalar &l, const Scalar &u)
 
void set_seed (const unsigned int seed)
 
unsigned int get_seed () const
 
- Public Member Functions inherited from RTOpPack::RTOpT< Scalar >
void get_reduct_type_num_entries (const Ptr< int > &num_values, const Ptr< int > &num_indexes, const Ptr< int > &num_chars) const
 Get the number of entries of each basic data type in the externalized state for a reduction object for this operator.
 
Teuchos::RCP< ReductTargetreduct_obj_create () const
 Creates a new reduction target object initialized and ready to be used in a reduction.
 
void reduce_reduct_objs (const ReductTarget &in_reduct_obj, const Ptr< ReductTarget > &inout_reduct_obj) const
 Reduce intermediate reduction target objects.
 
void reduct_obj_reinit (const Ptr< ReductTarget > &reduct_obj) const
 Reinitialize an already created reduction object.
 
void extract_reduct_obj_state (const ReductTarget &reduct_obj, const ArrayView< primitive_value_type > &value_data, const ArrayView< index_type > &index_data, const ArrayView< char_type > &char_data) const
 Extract the state of an already created reduction object.
 
void load_reduct_obj_state (const ArrayView< const primitive_value_type > &value_data, const ArrayView< const index_type > &index_data, const ArrayView< const char_type > &char_data, const Ptr< ReductTarget > &reduct_obj) const
 Load the state of an already created reduction object given arrays of primitive objects.
 
std::string op_name () const
 Return the name (as a null-terminated C-style string) of the operator.
 
bool coord_invariant () const
 Returns true if this operator is coordinate invariant.
 
Range1D range () const
 Returns the continuous range of elements that this operator is defined over.
 
void apply_op (const ArrayView< const ConstSubVectorView< Scalar > > &sub_vecs, const ArrayView< const SubVectorView< Scalar > > &targ_sub_vecs, const Ptr< ReductTarget > &reduct_obj) const
 Apply the reduction/transformation operator to a set of sub-vectors.
 

Static Public Member Functions

static void set_static_seed (const unsigned int static_seed)
 
static unsigned int get_static_seed ()
 

Overridden from RTOpT

static unsigned int static_seed_ = 0
 
unsigned int seed_
 
Scalar l_
 
Scalar u_
 
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
 

Additional Inherited Members

- Public Types inherited from RTOpPack::RTOpT< Scalar >
typedef PrimitiveTypeTraits< Scalar, Scalar >::primitiveType primitive_value_type
 
- Protected Member Functions inherited from RTOpPack::RTOpT< Scalar >
 RTOpT (const std::string &op_name_base="")
 Constructor that creates an operator name appended with the type.
 
void setOpNameBase (const std::string &op_name_base)
 Just set the operator name.
 
virtual void get_reduct_type_num_entries_impl (const Ptr< int > &num_values, const Ptr< int > &num_indexes, const Ptr< int > &num_chars) const
 
virtual Teuchos::RCP< ReductTargetreduct_obj_create_impl () const
 
virtual void reduce_reduct_objs_impl (const ReductTarget &in_reduct_obj, const Ptr< ReductTarget > &inout_reduct_obj) const
 
virtual void reduct_obj_reinit_impl (const Ptr< ReductTarget > &reduct_obj) const
 
virtual void extract_reduct_obj_state_impl (const ReductTarget &reduct_obj, const ArrayView< primitive_value_type > &value_data, const ArrayView< index_type > &index_data, const ArrayView< char_type > &char_data) const
 
virtual void load_reduct_obj_state_impl (const ArrayView< const primitive_value_type > &value_data, const ArrayView< const index_type > &index_data, const ArrayView< const char_type > &char_data, const Ptr< ReductTarget > &reduct_obj) const
 
virtual std::string op_name_impl () const
 
virtual bool coord_invariant_impl () const
 
virtual Range1D range_impl () const
 

Detailed Description

template<class Scalar>
class RTOpPack::TOpRandomize< Scalar >

Generate a random vector in the range [l,u]: z0[i] = 0.5*((u-l)*Teuchos::ScalarTraits<Scalar>::random()+(u+l)), i=0...n-1.

The seed for the random number generator can be set by TOpRandomize<Scalar>::set_seed(s) where s is some unsigned integer. Note that this class generates random numbers based on the initial seed and the global element ID so this should produce the same pseudo-random elements independent of the number of processors being used.

The seed changes every time a new object is created in order to improve the randomness to some degree.

Definition at line 65 of file RTOpPack_TOpRandomize.hpp.

Constructor & Destructor Documentation

◆ TOpRandomize()

template<class Scalar >
RTOpPack::TOpRandomize< Scalar >::TOpRandomize ( const Scalar &  l = -ScalarTraits<Scalar>::one(),
const Scalar &  u = +ScalarTraits<Scalar>::one() 
)
inline

Definition at line 74 of file RTOpPack_TOpRandomize.hpp.

Member Function Documentation

◆ set_static_seed()

template<class Scalar >
static void RTOpPack::TOpRandomize< Scalar >::set_static_seed ( const unsigned int  static_seed)
inlinestatic

Definition at line 69 of file RTOpPack_TOpRandomize.hpp.

◆ get_static_seed()

template<class Scalar >
static unsigned int RTOpPack::TOpRandomize< Scalar >::get_static_seed ( )
inlinestatic

Definition at line 72 of file RTOpPack_TOpRandomize.hpp.

◆ set_bounds()

template<class Scalar >
void RTOpPack::TOpRandomize< Scalar >::set_bounds ( const Scalar &  l,
const Scalar &  u 
)
inline

Definition at line 85 of file RTOpPack_TOpRandomize.hpp.

◆ set_seed()

template<class Scalar >
void RTOpPack::TOpRandomize< Scalar >::set_seed ( const unsigned int  seed)
inline

Definition at line 88 of file RTOpPack_TOpRandomize.hpp.

◆ get_seed()

template<class Scalar >
unsigned int RTOpPack::TOpRandomize< Scalar >::get_seed ( ) const
inline

Definition at line 90 of file RTOpPack_TOpRandomize.hpp.

◆ apply_op_impl()

template<class Scalar >
void RTOpPack::TOpRandomize< Scalar >::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
inlinevirtual

Implements RTOpPack::RTOpT< Scalar >.

Definition at line 94 of file RTOpPack_TOpRandomize.hpp.

Member Data Documentation

◆ static_seed_

template<class Scalar >
unsigned int RTOpPack::TOpRandomize< Scalar >::static_seed_ = 0
staticprivate

Definition at line 128 of file RTOpPack_TOpRandomize.hpp.

◆ seed_

template<class Scalar >
unsigned int RTOpPack::TOpRandomize< Scalar >::seed_
private

Definition at line 129 of file RTOpPack_TOpRandomize.hpp.

◆ l_

template<class Scalar >
Scalar RTOpPack::TOpRandomize< Scalar >::l_
private

Definition at line 130 of file RTOpPack_TOpRandomize.hpp.

◆ u_

template<class Scalar >
Scalar RTOpPack::TOpRandomize< Scalar >::u_
private

Definition at line 131 of file RTOpPack_TOpRandomize.hpp.


The documentation for this class was generated from the following file: