HOPS
HOPS class reference
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
hops::MHO_Reducer< XArrayType, XFunctorType > Class Template Reference

Class MHO_Reducer. More...

#include <MHO_Reducer.hh>

Inheritance diagram for hops::MHO_Reducer< XArrayType, XFunctorType >:
[legend]

Public Types

using XItemType = typename XArrayType::value_type
 

Public Member Functions

 MHO_Reducer ()
 
virtual ~MHO_Reducer ()
 
void ClearAxisSelection ()
 De-selects all axes by setting internal flags and arrays to default values (no reduction) More...
 
void ReduceAxis (std::size_t axis_index)
 Sets axis index for reduction operation. More...
 
- Public Member Functions inherited from hops::MHO_UnaryOperator< XArrayType >
 MHO_UnaryOperator ()
 
virtual ~MHO_UnaryOperator ()
 
virtual bool Execute () override
 Executes operation using provided arguments and return type. More...
 
virtual bool Execute () override=0
 Function Execute. More...
 
virtual bool Initialize () override
 Initializes the system using in-place or out-of-place arguments. More...
 
virtual bool Initialize () override=0
 Function Initialize. More...
 
 MHO_Operator ()
 
virtual void SetArgs (const XArrayType *in, XArrayType *out)
 Setter for args. More...
 
virtual void SetArgs (XArrayType *in)
 Setter for args. More...
 
- Public Member Functions inherited from hops::MHO_Operator
 MHO_Operator ()
 
virtual ~MHO_Operator ()
 
std::string GetName () const
 Getter for operator name. More...
 
virtual double Priority () const
 Get the the priority field value. More...
 
void SetName (std::string name)
 Setter for operator name. More...
 
virtual void SetPriority (const double &priority)
 Setter for operator priority (determines order of execution within a operator category) More...
 

Protected Member Functions

virtual bool ExecuteInPlace (XArrayType *in) override
 Executes operation in-place by calling ExecuteOutOfPlace and copying result back to input. More...
 
virtual bool ExecuteOutOfPlace (const XArrayType *in, XArrayType *out) override
 Function ExecuteOutOfPlace - carries out the array reduction. More...
 
virtual bool InitializeInPlace (XArrayType *in) override
 Initializes XArrayType in-place by calling InitializeOutOfPlace with given workspace. More...
 
virtual bool InitializeOutOfPlace (const XArrayType *in, XArrayType *out) override
 Initializes out-of-place operation using input array and workspace. More...
 

Additional Inherited Members

- Protected Attributes inherited from hops::MHO_UnaryOperator< XArrayType >
bool fInPlace
 
std::tuple< XArrayType * > fInPlaceArgs
 
std::tuple< const XArrayType *, XArrayType * > fOutOfPlaceArgs
 

Detailed Description

template<typename XArrayType, template< typename > class XFunctorType>
class hops::MHO_Reducer< XArrayType, XFunctorType >

Class MHO_Reducer.

Reduce a multi-dimensional array via a templated operation (e.g. summation) along the (runtime) specified dimensions. The output array has the same dimensionality (i.e. XArrayType::rank::value). However, the axes over which reduction occured will have a size of 1. The output array will be resized if/as needed.

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Tue Nov 17 16:53:15 2020 -0500

Member Typedef Documentation

◆ XItemType

template<typename XArrayType , template< typename > class XFunctorType>
using hops::MHO_Reducer< XArrayType, XFunctorType >::XItemType = typename XArrayType::value_type

Constructor & Destructor Documentation

◆ MHO_Reducer()

template<typename XArrayType , template< typename > class XFunctorType>
hops::MHO_Reducer< XArrayType, XFunctorType >::MHO_Reducer ( )
inline

◆ ~MHO_Reducer()

template<typename XArrayType , template< typename > class XFunctorType>
virtual hops::MHO_Reducer< XArrayType, XFunctorType >::~MHO_Reducer ( )
inlinevirtual

Member Function Documentation

◆ ClearAxisSelection()

template<typename XArrayType , template< typename > class XFunctorType>
void hops::MHO_Reducer< XArrayType, XFunctorType >::ClearAxisSelection ( )
inline

De-selects all axes by setting internal flags and arrays to default values (no reduction)

◆ ExecuteInPlace()

template<typename XArrayType , template< typename > class XFunctorType>
virtual bool hops::MHO_Reducer< XArrayType, XFunctorType >::ExecuteInPlace ( XArrayType *  in)
inlineoverrideprotectedvirtual

Executes operation in-place by calling ExecuteOutOfPlace and copying result back to input.

Parameters
inInput array of type XArrayType*
Returns
Status of execution as boolean
Note
This is a virtual function.

Implements hops::MHO_UnaryOperator< XArrayType >.

◆ ExecuteOutOfPlace()

template<typename XArrayType , template< typename > class XFunctorType>
virtual bool hops::MHO_Reducer< XArrayType, XFunctorType >::ExecuteOutOfPlace ( const XArrayType *  in,
XArrayType *  out 
)
inlineoverrideprotectedvirtual

Function ExecuteOutOfPlace - carries out the array reduction.

Parameters
in(const XArrayType*)
out(XArrayType*)
Returns
Return value (bool)
Note
This is a virtual function.

Implements hops::MHO_UnaryOperator< XArrayType >.

◆ InitializeInPlace()

template<typename XArrayType , template< typename > class XFunctorType>
virtual bool hops::MHO_Reducer< XArrayType, XFunctorType >::InitializeInPlace ( XArrayType *  in)
inlineoverrideprotectedvirtual

Initializes XArrayType in-place by calling InitializeOutOfPlace with given workspace.

Parameters
inPointer to XArrayType object for initialization
Returns
Boolean indicating success of initialization
Note
This is a virtual function.

Implements hops::MHO_UnaryOperator< XArrayType >.

◆ InitializeOutOfPlace()

template<typename XArrayType , template< typename > class XFunctorType>
virtual bool hops::MHO_Reducer< XArrayType, XFunctorType >::InitializeOutOfPlace ( const XArrayType *  in,
XArrayType *  out 
)
inlineoverrideprotectedvirtual

Initializes out-of-place operation using input array and workspace.

Parameters
inInput array of type XArrayType
outOutput array of type XArrayType
Returns
True if initialization is successful, false otherwise
Note
This is a virtual function.

Implements hops::MHO_UnaryOperator< XArrayType >.

◆ ReduceAxis()

template<typename XArrayType , template< typename > class XFunctorType>
void hops::MHO_Reducer< XArrayType, XFunctorType >::ReduceAxis ( std::size_t  axis_index)
inline

Sets axis index for reduction operation.

set the indices of the axes over which we run the reduction. This must be set before we can initialize/execute for example for a 3D array, if we wanted to reduce along the last axis only we would call this->ReduceAxis(2), or alternatively if we wanted to reduce along both the first and last axis we would call this->ReduceAxis(0), this->ReduceAxis(2)

Parameters
axis_indexIndex of the axis to reduce.

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