For

Contract 2 tensors over head/tail modes and accumulate into result using a custom element-wise multiply-add op The contraction is done via a GEMM operation with fused indices as defined by gemm_config.

Template Parameters
ResultThe result tile type
LeftThe left-hand tile type
RightThe right-hand tile type
ElementMultiplyAddOpa callable type with signature
void (Result::value_type& result, Left::value_type const& left,
Right::value_type const& right)
that implements custom multiply-add operation:
result = (result) ? result add left mult right : left mult add
Parameters
resultThe contracted result; this can be null, will be initialized as needed
leftThe left-hand argument to be contracted
rightThe right-hand argument to be contracted
gemm_configA helper object used to simplify gemm operations
element_multiplyadd_opa custom multiply op operation for tensor elements
Returns
A tile whose element result[i,j] obtained by executing foreach k: element_multiplyadd_op(result[i,j], left[i,k], right[k,j]) plain tensors GEMM can be implemented (very inefficiently) using this method as follows:
gemm(result, left, right, gemm_config,
[factor](auto& result, const auto& left, const auto& right) {
result += scalar * (left * right)
});
btas::Tensor< T, Range, Storage > mult(const btas::Tensor< T, Range, Storage > &arg1, const btas::Tensor< T, Range, Storage > &arg2)
result[i] = arg1[i] * arg2[i]
Definition: btas.h:363
btas::Tensor< T, Range, Storage > add(const btas::Tensor< T, Range, Storage > &arg1, const btas::Tensor< T, Range, Storage > &arg2)
result[i] = arg1[i] + arg2[i]
Definition: btas.h:218
btas::Tensor< T, Range, Storage > gemm(const btas::Tensor< T, Range, Storage > &left, const btas::Tensor< T, Range, Storage > &right, Scalar factor, const TiledArray::math::GemmHelper &gemm_helper)
Definition: btas.h:596