TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable > Class Template Reference
Documentation
template<typename Result, typename Left, typename Right, bool LeftConsumable, bool RightConsumable>
class TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >
Tile multiplication operation.
This class implements element-wise multiplication of two tiles, optionally followed by a permutation of the result, that can be customized to arbitrary binary operation types. Thus this is essentially the binary std::transform
with std::multiplies
as the default binary op; the binary op is lowered automatically when applied to nested tensors.
- Template Parameters
-
Result The result tile type Left The left-hand argument type Right The right-hand argument type LeftConsumable If true
, the left-hand tile is a temporary and may be consumedRightConsumable If 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.
Public Types | |
typedef Mult< Result, Left, Right, LeftConsumable, RightConsumable > | Mult_ |
typedef Left | left_type |
Left-hand argument base type. More... | |
typedef Right | right_type |
Right-hand argument base type. More... | |
typedef Result | result_type |
The result tile type. More... | |
using | left_value_type = typename left_type::value_type |
using | right_value_type = typename right_type::value_type |
using | result_value_type = typename result_type::value_type |
using | element_op_type = result_value_type(const left_value_type &, const right_value_type &) |
Public Member Functions | |
Mult ()=default | |
template<typename ElementOp , typename = std::enable_if_t< !std::is_same_v<std::remove_reference_t<ElementOp>, Mult_> && std::is_invocable_r_v< result_value_type, std::remove_reference_t<ElementOp>, const left_value_type&, const right_value_type&>>> | |
Mult (ElementOp &&op) | |
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 |
Multiply-and-permute operator. More... | |
template<typename L , typename R > | |
result_type | operator() (L &&left, R &&right) const |
Multiply operator. More... | |
template<typename R > | |
result_type | consume_left (left_type &left, R &&right) const |
Multiply right to left. More... | |
template<typename L > | |
result_type | consume_right (L &&left, right_type &right) const |
Multiply left to right. 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
◆ element_op_type
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
using TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::element_op_type = result_value_type(const left_value_type&, const right_value_type&) |
◆ left_type
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
typedef Left TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::left_type |
◆ left_value_type
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
using TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::left_value_type = typename left_type::value_type |
◆ Mult_
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
typedef Mult<Result, Left, Right, LeftConsumable, RightConsumable> TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::Mult_ |
◆ result_type
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
typedef Result TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::result_type |
◆ result_value_type
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
using TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::result_value_type = typename result_type::value_type |
◆ right_type
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
typedef Right TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::right_type |
◆ right_value_type
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
using TiledArray::detail::Mult< Result, Left, Right, LeftConsumable, RightConsumable >::right_value_type = typename right_type::value_type |
Constructor & Destructor Documentation
◆ Mult() [1/2]
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
|
default |
The default constructor uses default op (std::multiplies
) for the element-wise operation. This is valid for both plain and nested tensors. (times op is lowered naturally)
◆ Mult() [2/2]
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
template<typename ElementOp , typename = std::enable_if_t< !std::is_same_v<std::remove_reference_t<ElementOp>, Mult_> && std::is_invocable_r_v< result_value_type, std::remove_reference_t<ElementOp>, const left_value_type&, const right_value_type&>>>
|
inlineexplicit |
Member Function Documentation
◆ consume_left()
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
template<typename R >
|
inline |
◆ consume_right()
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
template<typename L >
|
inline |
◆ operator()() [1/2]
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
template<typename L , typename R >
|
inline |
Multiply operator.
Compute the product of two tiles.
- Template Parameters
-
L The left-hand tile argument type R The right-hand tile argument type
- Parameters
-
left The left-hand tile argument right The right-hand tile argument
- Returns
- The scaled product of
left
andright
.
◆ operator()() [2/2]
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
template<typename L , typename R , typename Perm , typename = std::enable_if_t<TiledArray::detail::is_permutation_v<Perm>>>
|
inline |
Multiply-and-permute operator.
Compute the product of two tiles and permute the result.
- Template Parameters
-
L The left-hand tile argument type R The right-hand tile argument type
- Parameters
-
left The left-hand tile argument right The right-hand tile argument perm The permutation applied to the result tile
- Returns
- The permuted and scaled product of
left
andright
.
Member Data Documentation
◆ left_is_consumable
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
|
staticconstexpr |
◆ right_is_consumable
template<typename Result , typename Left , typename Right , bool LeftConsumable, bool RightConsumable>
|
staticconstexpr |
The documentation for this class was generated from the following file:
- TiledArray/tile_op/mult.h