TiledArray::detail::ContractReduce< Result, Left, Right, Scalar > Class Template Reference
Inheritance diagram for TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >:
Collaboration diagram for TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >:

Documentation

template<typename Result, typename Left, typename Right, typename Scalar>
class TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >

Contract and (sum) reduce operation.

This encodes a binary tensor contraction mapped to a GEMM, as well as the sum reduction and post-processing.

Template Parameters
ResultThe result tile type
LeftThe left-hand tile type
RightThe right-hand tile type
ScalarThe scaling factor type

Definition at line 232 of file contract_reduce.h.

Public Types

typedef ContractReduce< Result, Left, Right, Scalar > ContractReduce_
 This class type. More...
 
typedef ContractReduceBase< Result, Left, Right, Scalar > ContractReduceBase_
 This class type. More...
 
typedef ContractReduceBase_::first_argument_type first_argument_type
 The left tile type. More...
 
typedef ContractReduceBase_::second_argument_type second_argument_type
 The right tile type. More...
 
typedef Result result_type
 The result tile type. More...
 
typedef Scalar scalar_type
 
using elem_muladd_op_type = void(result_value_type &, const left_value_type &, const right_value_type &)
 
using left_value_type = typename Left::value_type
 
using result_value_type = typename Result::value_type
 
using right_value_type = typename Right::value_type
 
- Public Types inherited from TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >
typedef ContractReduceBase< Result, Left, Right, Scalar > ContractReduceBase_
 This class type. More...
 
typedef const Left & first_argument_type
 The left tile type. More...
 
typedef const Right & second_argument_type
 The right tile type. More...
 
typedef Result result_type
 The result type. More...
 
typedef Scalar scalar_type
 The scaling factor type. More...
 
using left_value_type = typename Left::value_type
 
using right_value_type = typename Right::value_type
 
using result_value_type = typename Result::value_type
 
using elem_muladd_op_type = void(result_value_type &, const left_value_type &, const right_value_type &)
 

Public Member Functions

 ContractReduce ()=default
 
 ContractReduce (const ContractReduce_ &)=default
 
 ContractReduce (ContractReduce_ &&)=default
 
 ~ContractReduce ()=default
 
ContractReduce_operator= (const ContractReduce_ &)=default
 
ContractReduce_operator= (ContractReduce_ &&)=default
 
template<typename Perm = BipartitePermutation, typename ElemMultAddOp = TiledArray::function_ref<elem_muladd_op_type>, typename = std::enable_if_t< TiledArray::detail::is_permutation_v<Perm> && std::is_invocable_r_v<void, std::remove_reference_t<ElemMultAddOp>, result_value_type&, const left_value_type&, const right_value_type&>>>
 ContractReduce (const math::blas::Op left_op, const math::blas::Op right_op, const scalar_type alpha, const unsigned int result_rank, const unsigned int left_rank, const unsigned int right_rank, const Perm &perm={}, ElemMultAddOp &&elem_muladd_op={})
 Construct contract/reduce functor. More...
 
result_type operator() () const
 Create a result type object. More...
 
result_type operator() (const result_type &temp) const
 Post processing step. More...
 
void operator() (result_type &result, const result_type &arg) const
 Reduce two result objects. More...
 
void operator() (result_type &result, const first_argument_type &left, const second_argument_type &right) const
 Contract a pair of tiles and add to a target tile. More...
 
- Public Member Functions inherited from TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >
 ContractReduceBase ()=default
 
 ContractReduceBase (const ContractReduceBase_ &)=default
 
 ContractReduceBase (ContractReduceBase_ &&)=default
 
 ~ContractReduceBase ()=default
 
ContractReduceBase_operator= (const ContractReduceBase_ &)=default
 
ContractReduceBase_operator= (ContractReduceBase_ &&)=default
 
template<typename Perm = BipartitePermutation, typename ElemMultAddOp = TiledArray::function_ref<elem_muladd_op_type>, typename = std::enable_if_t< TiledArray::detail::is_permutation_v<Perm> && std::is_invocable_r_v<void, std::remove_reference_t<ElemMultAddOp>, result_value_type&, const left_value_type&, const right_value_type&>>>
 ContractReduceBase (const math::blas::Op left_op, const math::blas::Op right_op, const scalar_type alpha, const unsigned int result_rank, const unsigned int left_rank, const unsigned int right_rank, const Perm &perm={}, ElemMultAddOp &&elem_muladd_op={})
 Construct contract/reduce functor. More...
 
const math::GemmHelpergemm_helper () const
 Gemm meta data accessor. More...
 
const BipartitePermutationperm () const
 Permutation accessor. More...
 
scalar_type factor () const
 Scaling factor accessor. More...
 
const auto & elem_muladd_op () const
 Element multiply-add op accessor. More...
 
unsigned int num_contract_ranks () const
 Compute the number of contracted ranks. More...
 
unsigned int result_rank () const
 Result rank accessor. More...
 
unsigned int left_rank () const
 Left-hand argument rank accessor. More...
 
unsigned int right_rank () const
 Right-hand argument rank accessor. More...
 

Additional Inherited Members

- Static Public Attributes inherited from TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >
static constexpr bool plain_tensors
 

Member Typedef Documentation

◆ ContractReduce_

template<typename Result , typename Left , typename Right , typename Scalar >
typedef ContractReduce<Result, Left, Right, Scalar> TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::ContractReduce_

This class type.

Definition at line 235 of file contract_reduce.h.

◆ ContractReduceBase_

template<typename Result , typename Left , typename Right , typename Scalar >
typedef ContractReduceBase<Result, Left, Right, Scalar> TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::ContractReduceBase_

This class type.

Definition at line 237 of file contract_reduce.h.

◆ elem_muladd_op_type

template<typename Result , typename Left , typename Right , typename Scalar >
using TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::elem_muladd_op_type = void(result_value_type&, const left_value_type&, const right_value_type&)

Definition at line 64 of file contract_reduce.h.

◆ first_argument_type

template<typename Result , typename Left , typename Right , typename Scalar >
typedef ContractReduceBase_::first_argument_type TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::first_argument_type

The left tile type.

Definition at line 239 of file contract_reduce.h.

◆ left_value_type

template<typename Result , typename Left , typename Right , typename Scalar >
using TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::left_value_type = typename Left::value_type

Definition at line 61 of file contract_reduce.h.

◆ result_type

template<typename Result , typename Left , typename Right , typename Scalar >
typedef Result TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::result_type

The result tile type.

Definition at line 242 of file contract_reduce.h.

◆ result_value_type

template<typename Result , typename Left , typename Right , typename Scalar >
using TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::result_value_type = typename Result::value_type

Definition at line 63 of file contract_reduce.h.

◆ right_value_type

template<typename Result , typename Left , typename Right , typename Scalar >
using TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::right_value_type = typename Right::value_type

Definition at line 62 of file contract_reduce.h.

◆ scalar_type

template<typename Result , typename Left , typename Right , typename Scalar >
typedef Scalar TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::scalar_type

Definition at line 243 of file contract_reduce.h.

◆ second_argument_type

template<typename Result , typename Left , typename Right , typename Scalar >
typedef ContractReduceBase_::second_argument_type TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::second_argument_type

The right tile type.

Definition at line 241 of file contract_reduce.h.

Constructor & Destructor Documentation

◆ ContractReduce() [1/4]

template<typename Result , typename Left , typename Right , typename Scalar >
TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::ContractReduce ( )
default

◆ ContractReduce() [2/4]

template<typename Result , typename Left , typename Right , typename Scalar >
TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::ContractReduce ( const ContractReduce_ )
default

◆ ContractReduce() [3/4]

template<typename Result , typename Left , typename Right , typename Scalar >
TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::ContractReduce ( ContractReduce_ &&  )
default

◆ ~ContractReduce()

template<typename Result , typename Left , typename Right , typename Scalar >
TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::~ContractReduce ( )
default

◆ ContractReduce() [4/4]

template<typename Result , typename Left , typename Right , typename Scalar >
template<typename Perm = BipartitePermutation, typename ElemMultAddOp = TiledArray::function_ref<elem_muladd_op_type>, typename = std::enable_if_t< TiledArray::detail::is_permutation_v<Perm> && std::is_invocable_r_v<void, std::remove_reference_t<ElemMultAddOp>, result_value_type&, const left_value_type&, const right_value_type&>>>
TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::ContractReduce ( const math::blas::Op  left_op,
const math::blas::Op  right_op,
const scalar_type  alpha,
const unsigned int  result_rank,
const unsigned int  left_rank,
const unsigned int  right_rank,
const Perm &  perm = {},
ElemMultAddOp &&  elem_muladd_op = {} 
)
inline

Construct contract/reduce functor.

Template Parameters
Perma permutation type
ElemMultAddOpa callable with signature elem_muladd_op_type
Parameters
left_opThe left-hand BLAS matrix operation
right_opThe right-hand BLAS matrix operation
alphaThe scaling factor applied to the contracted tiles
result_rankThe rank of the result tensor
left_rankThe rank of the left-hand tensor
right_rankThe rank of the right-hand tensor
permThe permutation to be applied to the result tensor (default = no permute)
elem_muladd_opThe element multiply-add op

Definition at line 280 of file contract_reduce.h.

Member Function Documentation

◆ operator()() [1/4]

template<typename Result , typename Left , typename Right , typename Scalar >
result_type TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::operator() ( ) const
inline

Create a result type object.

Initialize a result object for subsequent reductions

Definition at line 291 of file contract_reduce.h.

◆ operator()() [2/4]

template<typename Result , typename Left , typename Right , typename Scalar >
result_type TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::operator() ( const result_type temp) const
inline

Post processing step.

Definition at line 294 of file contract_reduce.h.

◆ operator()() [3/4]

template<typename Result , typename Left , typename Right , typename Scalar >
void TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::operator() ( result_type result,
const first_argument_type left,
const second_argument_type right 
) const
inline

Contract a pair of tiles and add to a target tile.

Contract left and right and add the result to result.

Parameters
[in,out]resultThe result object that will be the reduction target
[in]leftThe left-hand tile to be contracted
[in]rightThe right-hand tile to be contracted

Definition at line 322 of file contract_reduce.h.

◆ operator()() [4/4]

template<typename Result , typename Left , typename Right , typename Scalar >
void TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::operator() ( result_type result,
const result_type arg 
) const
inline

Reduce two result objects.

Add arg to result .

Parameters
[in,out]resultThe result object that will be the reduction target
[in]argThe argument that will be added to result

Definition at line 310 of file contract_reduce.h.

◆ operator=() [1/2]

template<typename Result , typename Left , typename Right , typename Scalar >
ContractReduce_& TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::operator= ( const ContractReduce_ )
default

◆ operator=() [2/2]

template<typename Result , typename Left , typename Right , typename Scalar >
ContractReduce_& TiledArray::detail::ContractReduce< Result, Left, Right, Scalar >::operator= ( ContractReduce_ &&  )
default

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