TiledArray::detail::UnaryWrapper< Op > Class Template Reference

Documentation

template<typename Op>
class TiledArray::detail::UnaryWrapper< Op >

Unary tile operation wrapper.

This wrapper class is handles evaluation of lazily evaluated tiles in unary operations and forwards the evaluated arguments to the base operation object.

The base unary operation class must have the following interface.

template <typename Arg, typename Scalar, bool Consumable>
class Operator {
public:
typedef ... argument_type;
typedef ... result_type;
static constexpr bool is_consumable =
Consumable && std::is_same<result_type, Arg>::value;
// Constructor
Operator();
// Constructor required for scaling operations only, and may be omitted
for other operations Operator(const Scalar);
// Operation evaluation operators
// The A template parameter type may be Arg or
// TiledArray::ZeroTensor.
// Evaluate and permute the result.
template <typename A>
result_type operator()(A&& arg, const Permutation& perm) const;
// Evaluate only
// If is_consumable is true, then this
// may consume arg.
template <typename A>
result_type operator()(A&& arg) const;
// Evaluate the operation and try to consume the
// argument. This function may not consume arg if it is not consumable.
template <typename A>
}; // class Operator
Template Parameters
OpThe base binary operation type

Definition at line 83 of file unary_wrapper.h.

Public Types

typedef UnaryWrapper< Op > UnaryWrapper_
 
typedef Op::argument_type argument_type
 Argument type. More...
 
typedef Op::result_type result_type
 The result tile type. More...
 
template<typename T >
using eval_t = typename eval_trait< std::decay_t< T > >::type
 

Public Member Functions

 UnaryWrapper (const UnaryWrapper_ &)=default
 
 UnaryWrapper (UnaryWrapper_ &&)=default
 
 ~UnaryWrapper ()=default
 
UnaryWrapper_operator= (const UnaryWrapper_ &)=default
 
UnaryWrapper_operator= (UnaryWrapper_ &&)=default
 
 UnaryWrapper (const Op &op, const BipartitePermutation &perm)
 
 UnaryWrapper (const Op &op)
 
const BipartitePermutationpermutation () const
 Permutation accessor. More...
 
auto operator() (argument_type &arg) const
 Apply operator to arg and possibly permute the result. More...
 
auto operator() (const argument_type &arg) const
 Apply operator to arg and possibly permute the result. More...
 
template<typename A , std::enable_if_t< is_nonarray_lazy_tile_v< A >> * = nullptr>
auto operator() (A &&arg) const
 Evaluate a lazy tile. More...
 
template<typename A , std::enable_if_t< is_array_tile_v< A >> * = nullptr>
auto operator() (A &&arg) const
 Evaluate a lazy array tile. More...
 
template<typename A , std::enable_if_t< is_lazy_tile_v< A >> * = nullptr>
auto consume (A &&arg) const
 Consume a lazy tile. More...
 
template<typename A , std::enable_if_t<!is_lazy_tile_v< A >> * = nullptr>
result_type consume (A &&arg) const
 

Static Public Attributes

static constexpr bool is_consumable = Op::is_consumable
 Boolean value that indicates the argument can always be consumed. More...
 
template<typename T >
static constexpr bool is_lazy_tile_v = is_lazy_tile<std::decay_t<T>>::value
 
template<typename T >
static constexpr bool is_array_tile_v = is_array_tile<std::decay_t<T>>::value
 
template<typename T >
static constexpr bool is_nonarray_lazy_tile_v
 

Member Typedef Documentation

◆ argument_type

template<typename Op >
typedef Op::argument_type TiledArray::detail::UnaryWrapper< Op >::argument_type

Argument type.

Definition at line 86 of file unary_wrapper.h.

◆ eval_t

template<typename Op >
template<typename T >
using TiledArray::detail::UnaryWrapper< Op >::eval_t = typename eval_trait<std::decay_t<T> >::type

Definition at line 103 of file unary_wrapper.h.

◆ result_type

template<typename Op >
typedef Op::result_type TiledArray::detail::UnaryWrapper< Op >::result_type

The result tile type.

Definition at line 87 of file unary_wrapper.h.

◆ UnaryWrapper_

template<typename Op >
typedef UnaryWrapper<Op> TiledArray::detail::UnaryWrapper< Op >::UnaryWrapper_

Definition at line 85 of file unary_wrapper.h.

Constructor & Destructor Documentation

◆ UnaryWrapper() [1/4]

template<typename Op >
TiledArray::detail::UnaryWrapper< Op >::UnaryWrapper ( const UnaryWrapper_ )
default

◆ UnaryWrapper() [2/4]

template<typename Op >
TiledArray::detail::UnaryWrapper< Op >::UnaryWrapper ( UnaryWrapper_ &&  )
default

◆ ~UnaryWrapper()

template<typename Op >
TiledArray::detail::UnaryWrapper< Op >::~UnaryWrapper ( )
default

◆ UnaryWrapper() [3/4]

template<typename Op >
TiledArray::detail::UnaryWrapper< Op >::UnaryWrapper ( const Op &  op,
const BipartitePermutation perm 
)
inline

Definition at line 117 of file unary_wrapper.h.

◆ UnaryWrapper() [4/4]

template<typename Op >
TiledArray::detail::UnaryWrapper< Op >::UnaryWrapper ( const Op &  op)
inline

Definition at line 120 of file unary_wrapper.h.

Member Function Documentation

◆ consume() [1/2]

template<typename Op >
template<typename A , std::enable_if_t< is_lazy_tile_v< A >> * = nullptr>
auto TiledArray::detail::UnaryWrapper< Op >::consume ( A &&  arg) const
inline

Consume a lazy tile.

Definition at line 187 of file unary_wrapper.h.

Here is the call graph for this function:

◆ consume() [2/2]

template<typename Op >
template<typename A , std::enable_if_t<!is_lazy_tile_v< A >> * = nullptr>
result_type TiledArray::detail::UnaryWrapper< Op >::consume ( A &&  arg) const
inline

Definition at line 204 of file unary_wrapper.h.

◆ operator()() [1/4]

template<typename Op >
template<typename A , std::enable_if_t< is_nonarray_lazy_tile_v< A >> * = nullptr>
auto TiledArray::detail::UnaryWrapper< Op >::operator() ( A &&  arg) const
inline

Evaluate a lazy tile.

This function will evaluate arg, then pass the evaluated tile to the Op callable.

Template Parameters
AThe lazy tile type
Parameters
argThe lazy tile argument
Returns
The result of the unary operation applied to the evaluated arg.

Definition at line 154 of file unary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [2/4]

template<typename Op >
template<typename A , std::enable_if_t< is_array_tile_v< A >> * = nullptr>
auto TiledArray::detail::UnaryWrapper< Op >::operator() ( A &&  arg) const
inline

Evaluate a lazy array tile.

This function will evaluate arg, then pass the evaluated tile to the Op callable , optionally consuming the evaluated tile in the process.

Template Parameters
AThe lazy tile type
Parameters
argThe lazy tile argument
Returns
The result of the unary operation applied to the evaluated arg.

Definition at line 167 of file unary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [3/4]

template<typename Op >
auto TiledArray::detail::UnaryWrapper< Op >::operator() ( argument_type arg) const
inline

Apply operator to arg and possibly permute the result.

Parameters
argThe argument
Returns
The result tile from the unary operation applied to the arg .

Definition at line 132 of file unary_wrapper.h.

◆ operator()() [4/4]

template<typename Op >
auto TiledArray::detail::UnaryWrapper< Op >::operator() ( const argument_type arg) const
inline

Apply operator to arg and possibly permute the result.

Parameters
argThe argument
Returns
The result tile from the unary operation applied to the arg .

Definition at line 141 of file unary_wrapper.h.

◆ operator=() [1/2]

template<typename Op >
UnaryWrapper_& TiledArray::detail::UnaryWrapper< Op >::operator= ( const UnaryWrapper_ )
default

◆ operator=() [2/2]

template<typename Op >
UnaryWrapper_& TiledArray::detail::UnaryWrapper< Op >::operator= ( UnaryWrapper_ &&  )
default

◆ permutation()

template<typename Op >
const BipartitePermutation& TiledArray::detail::UnaryWrapper< Op >::permutation ( ) const
inline

Permutation accessor.

Returns
A reference to the permutation applied to the result tile

Definition at line 125 of file unary_wrapper.h.

Member Data Documentation

◆ is_array_tile_v

template<typename Op >
template<typename T >
constexpr bool TiledArray::detail::UnaryWrapper< Op >::is_array_tile_v = is_array_tile<std::decay_t<T>>::value
staticconstexpr

Definition at line 96 of file unary_wrapper.h.

◆ is_consumable

template<typename Op >
constexpr bool TiledArray::detail::UnaryWrapper< Op >::is_consumable = Op::is_consumable
staticconstexpr

Boolean value that indicates the argument can always be consumed.

Definition at line 90 of file unary_wrapper.h.

◆ is_lazy_tile_v

template<typename Op >
template<typename T >
constexpr bool TiledArray::detail::UnaryWrapper< Op >::is_lazy_tile_v = is_lazy_tile<std::decay_t<T>>::value
staticconstexpr

Definition at line 93 of file unary_wrapper.h.

◆ is_nonarray_lazy_tile_v

template<typename Op >
template<typename T >
constexpr bool TiledArray::detail::UnaryWrapper< Op >::is_nonarray_lazy_tile_v
staticconstexpr
Initial value:
=
is_lazy_tile_v<T> && !is_array_tile_v<T>

Definition at line 99 of file unary_wrapper.h.


The documentation for this class was generated from the following file:
auto operator()(argument_type &arg) const
Apply operator to arg and possibly permute the result.
static constexpr bool is_consumable
Boolean value that indicates the argument can always be consumed.
Definition: unary_wrapper.h:90
Op::argument_type argument_type
Argument type.
Definition: unary_wrapper.h:86
auto consume(A &&arg) const
Consume a lazy tile.
Op::result_type result_type
The result tile type.
Definition: unary_wrapper.h:87