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

Documentation

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

Contract and (sum) reduce base.

This implementation class is used to provide shallow copy semantics for ContractReduce. It 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 52 of file contract_reduce.h.

Public Types

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

 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...
 

Static Public Attributes

static constexpr bool plain_tensors
 

Member Typedef Documentation

◆ ContractReduceBase_

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

This class type.

Definition at line 55 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 const Left& TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::first_argument_type

The left tile type.

Definition at line 56 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::ContractReduceBase< Result, Left, Right, Scalar >::result_type

The result type.

Definition at line 58 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::ContractReduceBase< Result, Left, Right, Scalar >::scalar_type

The scaling factor type.

Definition at line 59 of file contract_reduce.h.

◆ second_argument_type

template<typename Result , typename Left , typename Right , typename Scalar >
typedef const Right& TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::second_argument_type

The right tile type.

Definition at line 57 of file contract_reduce.h.

Constructor & Destructor Documentation

◆ ContractReduceBase() [1/4]

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

◆ ContractReduceBase() [2/4]

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

◆ ContractReduceBase() [3/4]

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

◆ ~ContractReduceBase()

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

◆ ContractReduceBase() [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::ContractReduceBase< Result, Left, Right, Scalar >::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 = {} 
)
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 145 of file contract_reduce.h.

Member Function Documentation

◆ elem_muladd_op()

template<typename Result , typename Left , typename Right , typename Scalar >
const auto& TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::elem_muladd_op ( ) const
inline

Element multiply-add op accessor.

Returns
A const reference to the element multiply-add op function_ref

Definition at line 182 of file contract_reduce.h.

Here is the caller graph for this function:

◆ factor()

template<typename Result , typename Left , typename Right , typename Scalar >
scalar_type TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::factor ( ) const
inline

Scaling factor accessor.

Returns
The scaling factor for this operation

Definition at line 174 of file contract_reduce.h.

Here is the caller graph for this function:

◆ gemm_helper()

template<typename Result , typename Left , typename Right , typename Scalar >
const math::GemmHelper& TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::gemm_helper ( ) const
inline

Gemm meta data accessor.

Returns
A const reference to the gemm helper object

Definition at line 158 of file contract_reduce.h.

Here is the caller graph for this function:

◆ left_rank()

template<typename Result , typename Left , typename Right , typename Scalar >
unsigned int TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::left_rank ( ) const
inline

Left-hand argument rank accessor.

Returns
The rank of the left-hand tile

Definition at line 208 of file contract_reduce.h.

◆ num_contract_ranks()

template<typename Result , typename Left , typename Right , typename Scalar >
unsigned int TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::num_contract_ranks ( ) const
inline

Compute the number of contracted ranks.

Returns
The number of ranks that are summed by this operation

Definition at line 192 of file contract_reduce.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ perm()

template<typename Result , typename Left , typename Right , typename Scalar >
const BipartitePermutation& TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::perm ( ) const
inline

Permutation accessor.

Returns
A const reference to the permutation for this operation

Definition at line 166 of file contract_reduce.h.

Here is the caller graph for this function:

◆ result_rank()

template<typename Result , typename Left , typename Right , typename Scalar >
unsigned int TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::result_rank ( ) const
inline

Result rank accessor.

Returns
The rank of the result tile

Definition at line 200 of file contract_reduce.h.

◆ right_rank()

template<typename Result , typename Left , typename Right , typename Scalar >
unsigned int TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::right_rank ( ) const
inline

Right-hand argument rank accessor.

Returns
The rank of the right-hand tile

Definition at line 216 of file contract_reduce.h.

Member Data Documentation

◆ plain_tensors

template<typename Result , typename Left , typename Right , typename Scalar >
constexpr bool TiledArray::detail::ContractReduceBase< Result, Left, Right, Scalar >::plain_tensors
staticconstexpr
Initial value:
=
!(TiledArray::detail::is_tensor_v<left_value_type> &&
TiledArray::detail::is_tensor_v<right_value_type> &&
TiledArray::detail::is_tensor_v<result_value_type>)

Definition at line 74 of file contract_reduce.h.


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