TiledArray  0.7.0
TiledArray::detail::BinaryWrapper< Op > Class Template Reference

Binary tile operation wrapper. More...

#include <binary_wrapper.h>

Public Types

typedef BinaryWrapper< Op > BinaryWrapper_
 
typedef Op::left_type left_type
 Left-hand argument type. More...
 
typedef Op::right_type right_type
 Right-hand 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

 BinaryWrapper (const BinaryWrapper< Op > &)=default
 
 BinaryWrapper (BinaryWrapper< Op > &&)=default
 
 ~BinaryWrapper ()=default
 
BinaryWrapper< Op > & operator= (const BinaryWrapper< Op > &)=default
 
BinaryWrapper< Op > & operator= (BinaryWrapper< Op > &&)=default
 
 BinaryWrapper (const Op &op, const Permutation &perm)
 
 BinaryWrapper (const Op &op)
 
template<typename L , typename R , std::enable_if_t<!(is_lazy_tile_v< L >||is_lazy_tile_v< R >)> * = nullptr>
auto operator() (L &&left, R &&right) const
 Evaluate two non-zero tiles and possibly permute. More...
 
template<typename R , std::enable_if_t<!is_lazy_tile_v< R > > * = nullptr>
auto operator() (const ZeroTensor &left, R &&right) const
 Evaluate a zero tile to a non-zero tiles and possibly permute. More...
 
template<typename L , std::enable_if_t<!is_lazy_tile_v< L > > * = nullptr>
auto operator() (L &&left, const ZeroTensor &right) const
 Evaluate a non-zero tiles to a zero tile and possibly permute. More...
 
template<typename L , typename R , std::enable_if_t< is_lazy_tile_v< L > &&is_lazy_tile_v< R > &&(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 Evaluate two lazy tiles. More...
 
template<typename L , typename R , std::enable_if_t< is_lazy_tile_v< L > &&(!is_lazy_tile_v< R >)&&(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 Evaluate lazy and non-lazy tiles. More...
 
template<typename L , typename R , std::enable_if_t<(!is_lazy_tile_v< L >)&&is_lazy_tile_v< R > &&(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 Evaluate non-lazy and lazy tiles. More...
 
template<typename L , typename R , std::enable_if_t< is_array_tile_v< L > &&is_array_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 Evaluate two lazy-array tiles. More...
 
template<typename L , typename R , std::enable_if_t< is_array_tile_v< L > &&(!is_lazy_tile_v< R >)&&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 
template<typename L , typename R , std::enable_if_t< is_array_tile_v< L > &&is_nonarray_lazy_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 
template<typename L , typename R , std::enable_if_t<(!is_lazy_tile_v< L >)&&is_array_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 
template<typename L , typename R , std::enable_if_t< is_nonarray_lazy_tile_v< L > &&is_array_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto operator() (L &&left, R &&right) const
 

Static Public Attributes

static constexpr bool left_is_consumable = Op::left_is_consumable
 Boolean value that indicates the left-hand argument can always be consumed. More...
 
static constexpr bool right_is_consumable = Op::right_is_consumable
 Boolean value that indicates the right-hand argument can always be consumed. More...
 
template<typename T >
static constexpr auto is_lazy_tile_v = is_lazy_tile<std::decay_t<T> >::value
 
template<typename T >
static constexpr auto is_array_tile_v = is_array_tile<std::decay_t<T> >::value
 
template<typename T >
static constexpr auto is_nonarray_lazy_tile_v = is_lazy_tile_v<T> && !is_array_tile_v<T>
 

Detailed Description

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

Binary tile operation wrapper.

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

The base binary operation class must have the following interface.

class Operator {
public:
typedef ... left_type;
typedef ... right_type;
typedef ... result_type;
static constexpr bool left_is_consumable =
LeftConsumable && std::is_same<result_type, Left>::value;
static constexpr bool right_is_consumable =
RightConsumable && std::is_same<result_type, Right>::value;
// Constructor
Operator();
// Constructor required for scaling operations only, and may be omitted for other operations
Operator(const Scalar);
// Operation evaluation operators
// L and R template parameters types may be Left and Right, respectively, or
// TiledArray::ZeroTensor.
// Evaluate the operation with left and right arguments and permute the result.
template <typename L, typename R>
result_type operator()(L&& left, R&& right, const Permutation& perm) const;
// Evaluate the operation with left and right arguments.
// If the left_is_consumable or right_is_consumable variables are true, then this
// will try to consume the left or right arguments, respectively.
template <typename L, typename R>
result_type operator()(L&& left, R&& right) const;
// Evaluate the operation with left and right arguments and try to consume the left-hand
// argument. This function may not consume left if it is not consumable (see is_consumable_tile trait).
template <typename R>
result_type consume_left(left_type& left, R&& right) const;
// Evaluate the operation with left and right arguments and try to consume the right-hand
// argument. This function may not consume right if it is not consumable (see is_consumable_tile trait).
template <typename L>
result_type consume_right(L&& left, right_type& right) const;
}; // class Operator
Template Parameters
OpThe base binary operation type

Definition at line 89 of file binary_wrapper.h.

Member Typedef Documentation

◆ BinaryWrapper_

template<typename Op >
typedef BinaryWrapper<Op> TiledArray::detail::BinaryWrapper< Op >::BinaryWrapper_

Definition at line 91 of file binary_wrapper.h.

◆ eval_t

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

Definition at line 112 of file binary_wrapper.h.

◆ left_type

template<typename Op >
typedef Op::left_type TiledArray::detail::BinaryWrapper< Op >::left_type

Left-hand argument type.

Definition at line 92 of file binary_wrapper.h.

◆ result_type

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

The result tile type.

Definition at line 94 of file binary_wrapper.h.

◆ right_type

template<typename Op >
typedef Op::right_type TiledArray::detail::BinaryWrapper< Op >::right_type

Right-hand argument type.

Definition at line 93 of file binary_wrapper.h.

Constructor & Destructor Documentation

◆ BinaryWrapper() [1/4]

template<typename Op >
TiledArray::detail::BinaryWrapper< Op >::BinaryWrapper ( const BinaryWrapper< Op > &  )
default

◆ BinaryWrapper() [2/4]

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

◆ ~BinaryWrapper()

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

◆ BinaryWrapper() [3/4]

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

Definition at line 128 of file binary_wrapper.h.

◆ BinaryWrapper() [4/4]

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

Definition at line 132 of file binary_wrapper.h.

Member Function Documentation

◆ operator()() [1/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t<!(is_lazy_tile_v< L >||is_lazy_tile_v< R >)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Evaluate two non-zero tiles and possibly permute.

Evaluate the result tile using the appropriate Derived class evaluation kernel.

Parameters
leftThe left-hand argument
rightThe right-hand argument
Returns
The result tile from the binary operation applied to the left and right arguments.

Definition at line 148 of file binary_wrapper.h.

Here is the caller graph for this function:

◆ operator()() [2/11]

template<typename Op >
template<typename R , std::enable_if_t<!is_lazy_tile_v< R > > * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( const ZeroTensor left,
R &&  right 
) const
inline

Evaluate a zero tile to a non-zero tiles and possibly permute.

Evaluate the result tile using the appropriate Derived class evaluation kernel.

Parameters
leftThe left-hand argument
rightThe right-hand argument
Returns
The result tile from the binary operation applied to the left and right arguments.

Definition at line 168 of file binary_wrapper.h.

◆ operator()() [3/11]

template<typename Op >
template<typename L , std::enable_if_t<!is_lazy_tile_v< L > > * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
const ZeroTensor right 
) const
inline

Evaluate a non-zero tiles to a zero tile and possibly permute.

Evaluate the result tile using the appropriate Derived class evaluation kernel.

Parameters
leftThe left-hand argument
rightThe right-hand argument
Returns
The result tile from the binary operation applied to the left and right arguments.

Definition at line 186 of file binary_wrapper.h.

◆ operator()() [4/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t< is_lazy_tile_v< L > &&is_lazy_tile_v< R > &&(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Evaluate two lazy tiles.

This function will evaluate the left and right , then pass the evaluated tiles to the appropriate BinaryInterfaceBase_::operator() function.

Template Parameters
LThe left-hand, lazy tile type
RThe right-hand, lazy tile type
Parameters
leftThe left-hand, lazy tile argument
rightThe right-hand, lazy tile argument
Returns
The result tile from the binary operation applied to the evaluated left and right .

Definition at line 213 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [5/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t< is_lazy_tile_v< L > &&(!is_lazy_tile_v< R >)&&(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Evaluate lazy and non-lazy tiles.

This function will evaluate the left , then pass the evaluated tile and right to the appropriate BinaryInterfaceBase_::operator() function.

Template Parameters
LThe left-hand, lazy tile type
RThe right-hand, non-lazy tile type
Parameters
leftThe left-hand, lazy tile argument
rightThe right-hand, non-lazy tile argument
Returns
The result tile from the binary operation applied to the evaluated left and right .

Definition at line 239 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [6/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t<(!is_lazy_tile_v< L >)&&is_lazy_tile_v< R > &&(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Evaluate non-lazy and lazy tiles.

This function will evaluate the right , then pass the evaluated tile and left to the appropriate BinaryInterfaceBase_::operator() function.

Template Parameters
LThe left-hand, non-lazy tile type
RThe right-hand, lazy tile type
Parameters
leftThe left-hand, non-lazy tile argument
rightThe right-hand, lazy tile argument
Returns
The result tile from the binary operation applied to the evaluated left and right .

Definition at line 263 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [7/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t< is_array_tile_v< L > &&is_array_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Evaluate two lazy-array tiles.

This function will evaluate the left and right , then pass the evaluated tiles to the appropriate Derived class evaluation kernel.

Template Parameters
LThe left-hand, lazy-array tile type
RThe right-hand, lazy-array tile type
Parameters
leftThe left-hand, non-lazy tile argument
rightThe right-hand, lazy tile argument
Returns
The result tile from the binary operation applied to the evaluated left and right .

Definition at line 283 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [8/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t< is_array_tile_v< L > &&(!is_lazy_tile_v< R >)&&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Definition at line 312 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [9/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t< is_array_tile_v< L > &&is_nonarray_lazy_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Definition at line 329 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [10/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t<(!is_lazy_tile_v< L >)&&is_array_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Definition at line 347 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator()() [11/11]

template<typename Op >
template<typename L , typename R , std::enable_if_t< is_nonarray_lazy_tile_v< L > &&is_array_tile_v< R > &&!(left_is_consumable||right_is_consumable)> * = nullptr>
auto TiledArray::detail::BinaryWrapper< Op >::operator() ( L &&  left,
R &&  right 
) const
inline

Definition at line 364 of file binary_wrapper.h.

Here is the call graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Member Data Documentation

◆ is_array_tile_v

template<typename Op >
template<typename T >
constexpr auto TiledArray::detail::BinaryWrapper< Op >::is_array_tile_v = is_array_tile<std::decay_t<T> >::value
static

Definition at line 106 of file binary_wrapper.h.

◆ is_lazy_tile_v

template<typename Op >
template<typename T >
constexpr auto TiledArray::detail::BinaryWrapper< Op >::is_lazy_tile_v = is_lazy_tile<std::decay_t<T> >::value
static

Definition at line 103 of file binary_wrapper.h.

◆ is_nonarray_lazy_tile_v

template<typename Op >
template<typename T >
constexpr auto TiledArray::detail::BinaryWrapper< Op >::is_nonarray_lazy_tile_v = is_lazy_tile_v<T> && !is_array_tile_v<T>
static

Definition at line 109 of file binary_wrapper.h.

◆ left_is_consumable

template<typename Op >
constexpr bool TiledArray::detail::BinaryWrapper< Op >::left_is_consumable = Op::left_is_consumable
static

Boolean value that indicates the left-hand argument can always be consumed.

Definition at line 98 of file binary_wrapper.h.

◆ right_is_consumable

template<typename Op >
constexpr bool TiledArray::detail::BinaryWrapper< Op >::right_is_consumable = Op::right_is_consumable
static

Boolean value that indicates the right-hand argument can always be consumed.

Definition at line 100 of file binary_wrapper.h.


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