TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable > Class Template Reference

Documentation

template<typename Result, typename Left, typename Right, typename Scalar, bool LeftConsumable, bool RightConsumable>
class TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >

Tile scale-addition operation.

This addition operation will add the content two tiles and apply a permutation to the result tensor. If no permutation is given or the permutation is null, then the result is not permuted.

Template Parameters
ResultThe result tile type
LeftThe left-hand argument type
RightThe right-hand argument type
ScalarThe scaling factor type
LeftConsumableIf true, the left-hand tile is a temporary and may be consumed
RightConsumableIf true, the right-hand tile is a temporary and may be consumed
Note
Input tiles can be consumed only if their type matches the result type.

Definition at line 238 of file add.h.

Public Types

typedef ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable > ScalAdd_
 This class type. More...
 
typedef Left left_type
 Left-hand argument base type. More...
 
typedef Right right_type
 Right-hand argument base type. More...
 
typedef Scalar scalar_type
 Scaling factor type. More...
 
typedef Result result_type
 Result tile type. More...
 

Public Member Functions

 ScalAdd (const ScalAdd_ &)=default
 
 ScalAdd (ScalAdd_ &&)=default
 
 ~ScalAdd ()=default
 
ScalAdd_operator= (const ScalAdd_ &)=default
 
ScalAdd_operator= (ScalAdd_ &&)=default
 
 ScalAdd (const Scalar factor)
 Constructor. More...
 
template<typename L , typename R , typename Perm , typename = std::enable_if_t<TiledArray::detail::is_permutation_v<Perm>>>
result_type operator() (L &&left, R &&right, const Perm &perm) const
 Scale-add-and-permute operator. More...
 
template<typename L , typename R >
result_type operator() (L &&left, R &&right) const
 Scale-and-add operator. More...
 
template<typename R >
result_type consume_left (left_type &left, R &&right) const
 Add right to left and scale the result. More...
 
template<typename L >
result_type consume_right (L &&left, right_type &right) const
 Add left to right and scale the result. More...
 

Static Public Attributes

static constexpr bool left_is_consumable
 Indicates whether it is possible to consume the left tile. More...
 
static constexpr bool right_is_consumable
 Indicates whether it is possible to consume the right tile. More...
 

Member Typedef Documentation

◆ left_type

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
typedef Left TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::left_type

Left-hand argument base type.

Definition at line 243 of file add.h.

◆ result_type

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
typedef Result TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::result_type

Result tile type.

Definition at line 246 of file add.h.

◆ right_type

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
typedef Right TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::right_type

Right-hand argument base type.

Definition at line 244 of file add.h.

◆ ScalAdd_

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
typedef ScalAdd<Result, Left, Right, Scalar, LeftConsumable, RightConsumable> TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::ScalAdd_

This class type.

Definition at line 242 of file add.h.

◆ scalar_type

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
typedef Scalar TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::scalar_type

Scaling factor type.

Definition at line 245 of file add.h.

Constructor & Destructor Documentation

◆ ScalAdd() [1/3]

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::ScalAdd ( const ScalAdd_ )
default

◆ ScalAdd() [2/3]

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::ScalAdd ( ScalAdd_ &&  )
default

◆ ~ScalAdd()

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::~ScalAdd ( )
default

◆ ScalAdd() [3/3]

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::ScalAdd ( const Scalar  factor)
inlineexplicit

Constructor.

Parameters
factorThe scaling factor applied to result tiles

Definition at line 344 of file add.h.

Member Function Documentation

◆ consume_left()

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
template<typename R >
result_type TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::consume_left ( left_type left,
R &&  right 
) const
inline

Add right to left and scale the result.

Add the right tile to the left. The right tile may be replaced with ZeroTensor argument, in which case the argument's element values are assumed to be 0.

Template Parameters
RThe right-hand tile argument type
Parameters
leftThe left-hand tile argument
rightThe right-hand tile argument
Returns
The sum of left and right.

Definition at line 390 of file add.h.

◆ consume_right()

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
template<typename L >
result_type TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::consume_right ( L &&  left,
right_type right 
) const
inline

Add left to right and scale the result.

Add the left tile to the right, and scale the resulting left tile. The left tile may be replaced with ZeroTensor argument, in which case the argument's element values are assumed to be 0.

Template Parameters
LThe left-hand tile argument type
Parameters
leftThe left-hand tile argument
rightThe right-hand tile argument
Returns
The sum of left and right.

Definition at line 410 of file add.h.

◆ operator()() [1/2]

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
template<typename L , typename R >
result_type TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::operator() ( L &&  left,
R &&  right 
) const
inline

Scale-and-add operator.

Compute the scaled sum of two tiles. One of the argument tiles may be replaced with ZeroTensor argument, in which case the argument's element values are assumed to be 0.

Template Parameters
LThe left-hand tile argument type
RThe right-hand tile argument type
Parameters
leftThe left-hand tile argument
rightThe right-hand tile argument
Returns
The scaled sum of left and right.

Definition at line 375 of file add.h.

◆ operator()() [2/2]

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
template<typename L , typename R , typename Perm , typename = std::enable_if_t<TiledArray::detail::is_permutation_v<Perm>>>
result_type TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::operator() ( L &&  left,
R &&  right,
const Perm &  perm 
) const
inline

Scale-add-and-permute operator.

Compute the scaled sum of two tiles and permute the result. One of the argument tiles may be replaced with ZeroTensor argument, in which case the argument's element values are assumed to be 0.

Template Parameters
LThe left-hand tile argument type
RThe right-hand tile argument type
Parameters
leftThe left-hand tile argument
rightThe right-hand tile argument
permThe permutation applied to the result tile
Returns
The permuted and scaled sum of left and right.

Definition at line 360 of file add.h.

◆ operator=() [1/2]

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
ScalAdd_& TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::operator= ( const ScalAdd_ )
default

◆ operator=() [2/2]

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
ScalAdd_& TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::operator= ( ScalAdd_ &&  )
default

Member Data Documentation

◆ left_is_consumable

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
constexpr bool TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::left_is_consumable
staticconstexpr
Initial value:
=
LeftConsumable && std::is_same<result_type, left_type>::value

Indicates whether it is possible to consume the left tile.

Definition at line 249 of file add.h.

◆ right_is_consumable

template<typename Result , typename Left , typename Right , typename Scalar , bool LeftConsumable, bool RightConsumable>
constexpr bool TiledArray::detail::ScalAdd< Result, Left, Right, Scalar, LeftConsumable, RightConsumable >::right_is_consumable
staticconstexpr
Initial value:
=
RightConsumable && std::is_same<result_type, right_type>::value

Indicates whether it is possible to consume the right tile.

Definition at line 252 of file add.h.


The documentation for this class was generated from the following file:
  • TiledArray/tile_op/add.h