Non-intrusive tile interface

Documentation

Typedefs

template<typename... T>
using TiledArray::result_of_subt_t = decltype(subt(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_subt_to_t = decltype(subt_to(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_mult_t = decltype(mult(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_mult_to_t = decltype(mult_to(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_binary_t = decltype(binary(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_inplace_binary_t = decltype(inplace_binary(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_neg_t = decltype(neg(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_neg_to_t = decltype(neg_to(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_conj_t = decltype(conj(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_conj_to_t = decltype(conj_to(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_unary_t = decltype(unary(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_inplace_unary_t = decltype(inplace_unary(std::declval< T >()...))
 
template<typename... T>
using TiledArray::result_of_gemm_t = decltype(gemm(std::declval< T >()...))
 
template<typename T >
using TiledArray::result_of_sum_t = decltype(sum(std::declval< T >()))
 
template<typename T >
using TiledArray::result_of_product_t = decltype(product(std::declval< T >()))
 
template<typename T >
using TiledArray::result_of_squared_norm_t = decltype(squared_norm(std::declval< T >()))
 
template<typename T , typename ResultType = T>
using TiledArray::result_of_norm_t = decltype(norm(std::declval< T >(), std::declval< ResultType & >()))
 
template<typename T >
using TiledArray::result_of_max_t = decltype(max(std::declval< T >()))
 
template<typename T >
using TiledArray::result_of_min_t = decltype(min(std::declval< T >()))
 
template<typename T >
using TiledArray::result_of_abs_max_t = decltype(abs_max(std::declval< T >()))
 
template<typename T >
using TiledArray::result_of_abs_min_t = decltype(abs_min(std::declval< T >()))
 
template<typename L , typename R >
using TiledArray::result_of_dot_t = decltype(dot(std::declval< L >(), std::declval< R >()))
 

Functions

template<typename Left , typename Right >
auto TiledArray::subt (const Left &left, const Right &right)
 Subtract tile arguments. More...
 
template<typename Left , typename Right , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
auto TiledArray::subt (const Left &left, const Right &right, const Scalar factor)
 Subtract and scale tile arguments. More...
 
template<typename Left , typename Right , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
auto TiledArray::subt (const Left &left, const Right &right, const Perm &perm)
 Subtract and permute tile arguments. More...
 
template<typename Left , typename Right , typename Scalar , typename Perm , typename std::enable_if< detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
auto TiledArray::subt (const Left &left, const Right &right, const Scalar factor, const Perm &perm)
 Subtract, scale, and permute tile arguments. More...
 
template<typename Arg , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
auto TiledArray::subt (const Arg &arg, const Scalar value)
 Subtract a scalar constant from the tile argument. More...
 
template<typename Arg , typename Scalar , typename Perm , typename std::enable_if< detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
auto TiledArray::subt (const Arg &arg, const Scalar value, const Perm &perm)
 Subtract a constant scalar and permute tile argument. More...
 
template<typename Result , typename Arg >
Result & TiledArray::subt_to (Result &result, const Arg &arg)
 Subtract from the result tile. More...
 
template<typename Result , typename Arg , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
Result & TiledArray::subt_to (Result &result, const Arg &arg, const Scalar factor)
 Subtract and scale from the result tile. More...
 
template<typename Result , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
Result & TiledArray::subt_to (Result &result, const Scalar value)
 Subtract constant scalar from the result tile. More...
 
template<typename Left , typename Right >
auto TiledArray::mult (const Left &left, const Right &right)
 Multiplication tile arguments. More...
 
template<typename Left , typename Right , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
auto TiledArray::mult (const Left &left, const Right &right, const Scalar factor)
 Multiplication and scale tile arguments. More...
 
template<typename Left , typename Right , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm> && detail::has_member_function_mult_anyreturn_v< const Left, const Right&, const Perm&>>>
auto TiledArray::mult (const Left &left, const Right &right, const Perm &perm)
 Multiplication and permute tile arguments. More...
 
template<typename Left , typename Right , typename Scalar , typename Perm , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >> * = nullptr>
auto TiledArray::mult (const Left &left, const Right &right, const Scalar factor, const Perm &perm)
 Multiplication, scale, and permute tile arguments. More...
 
template<typename Result , typename Arg >
Result & TiledArray::mult_to (Result &result, const Arg &arg)
 Multiply to the result tile. More...
 
template<typename Result , typename Arg , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
Result & TiledArray::mult_to (Result &result, const Arg &arg, const Scalar factor)
 Multiply and scale to the result tile. More...
 
template<typename Left , typename Right , typename Op >
decltype(auto) TiledArray::binary (const Left &left, const Right &right, Op &&op)
 Binary element-wise transform producing a new tile. More...
 
template<typename Left , typename Right , typename Op , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
decltype(auto) TiledArray::binary (const Left &left, const Right &right, Op &&op, const Perm &perm)
 Binary element-wise transform producing a new tile. More...
 
template<typename Left , typename Right , typename Op >
Left & TiledArray::inplace_binary (Left &left, const Right &right, Op &&op)
 Binary element-wise in-place transform. More...
 
template<typename Arg >
auto TiledArray::neg (const Arg &arg)
 Negate the tile argument. More...
 
template<typename Arg , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
auto TiledArray::neg (const Arg &arg, const Perm &perm)
 Negate and permute tile argument. More...
 
template<typename Result >
Result & TiledArray::neg_to (Result &result)
 Negate the tile argument in-place. More...
 
template<typename Arg >
auto TiledArray::conj (const Arg &arg)
 Create a complex conjugated copy of a tile. More...
 
template<typename Arg , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric_v< Scalar >>::type * = nullptr>
auto TiledArray::conj (const Arg &arg, const Scalar factor)
 Create a complex conjugated and scaled copy of a tile. More...
 
template<typename Arg , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
auto TiledArray::conj (const Arg &arg, const Perm &perm)
 Create a complex conjugated and permuted copy of a tile. More...
 
template<typename Arg , typename Scalar , typename Perm , typename std::enable_if< TiledArray::detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
auto TiledArray::conj (const Arg &arg, const Scalar factor, const Perm &perm)
 Create a complex conjugated, scaled, and permuted copy of a tile. More...
 
template<typename Result >
Result & TiledArray::conj_to (Result &result)
 In-place complex conjugate a tile. More...
 
template<typename Result , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric_v< Scalar >>::type * = nullptr>
Result & TiledArray::conj_to (Result &result, const Scalar factor)
 In-place complex conjugate and scale a tile. More...
 
template<typename Arg , typename Op >
decltype(auto) TiledArray::unary (const Arg &arg, Op &&op)
 Unary element-wise transform producing a new tile. More...
 
template<typename Arg , typename Op , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
decltype(auto) TiledArray::unary (const Arg &arg, Op &&op, const Perm &perm)
 Unary element-wise transform producing a new tile. More...
 
template<typename Result , typename Op >
Result & TiledArray::inplace_unary (Result &arg, Op &&op)
 Unary element-wise in-place transform. More...
 
template<typename Left , typename Right , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
auto TiledArray::gemm (const Left &left, const Right &right, const Scalar factor, const math::GemmHelper &gemm_config)
 Contract 2 tensors over head/tail modes and scale the product. More...
 
template<typename Result , typename Left , typename Right , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
Result & TiledArray::gemm (Result &result, const Left &left, const Right &right, const Scalar factor, const math::GemmHelper &gemm_config)
 
template<typename Result , typename Left , typename Right , typename ElementMultiplyAddOp , std::enable_if_t< std::is_invocable_r_v< void, std::remove_reference_t< ElementMultiplyAddOp >, typename Result::value_type &, const typename Left::value_type &, const typename Right::value_type & >> * = nullptr>
Result & TiledArray::gemm (Result &result, const Left &left, const Right &right, const math::GemmHelper &gemm_config, ElementMultiplyAddOp &&element_multiplyadd_op)
 
template<typename Arg >
auto TiledArray::sum (const Arg &arg)
 Sum the hyper-diagonal elements a tile. More...
 
template<typename Arg >
auto TiledArray::product (const Arg &arg)
 Multiply the elements of a tile. More...
 
template<typename Arg >
auto TiledArray::squared_norm (const Arg &arg)
 Squared vector 2-norm of the elements of a tile. More...
 
template<typename Arg >
auto TiledArray::norm (const Arg &arg)
 Vector 2-norm of a tile. More...
 
template<typename Arg , typename ResultType >
void TiledArray::norm (const Arg &arg, ResultType &result)
 Vector 2-norm of a tile. More...
 
template<typename Arg >
auto TiledArray::max (const Arg &arg)
 Maximum element of a tile. More...
 
template<typename Arg >
auto TiledArray::min (const Arg &arg)
 Minimum element of a tile. More...
 
template<typename Arg >
auto TiledArray::abs_max (const Arg &arg)
 Absolute maximum element of a tile. More...
 
template<typename Arg >
auto TiledArray::abs_min (const Arg &arg)
 Absolute mainimum element of a tile. More...
 
template<typename Left , typename Right >
auto TiledArray::dot (const Left &left, const Right &right)
 Vector dot product of two tiles. More...
 
template<typename Left , typename Right >
auto TiledArray::inner_product (const Left &left, const Right &right)
 Vector inner product of two tiles. More...
 

Introduction

To use a user defined tile types in TiledArray expressions, users must define a set of interface function that define basic arithmetic and query operations. It is not necessary to define all operations, only those that are required for the algebraic tensor operations used in your application. However, more than one function may be necessary for a given expression operator. Each function has an intrusive and non-intrusive interface that may be used to implement the required functionality. Below is a description of each interface function, the intrusive and non-intrusive function signatures of the function, and, in some cases, a reference implementation. The reference implementation assumes that the tensor type has a range() member for convenience, but this is not necessary. Tensor implementations may have any arbitrary range interface function(s).

Minimum Tile Requirements

The minimum requirements for user defined tile types are:

  • An accessible copy constructor
  • An accessible destructor
  • Must be a shallow copy object

TiledArray assumes tiles are shallow copy objects for efficiency when coping objects and to avoid unnecessary replication of data. A shallow copy object is an object that only copies a pointer (and updates a reference counter) instead of explicitly copying all elements of the tile. If your tile object is not a shallow copy object, you can use the TiledArray::Tile class to wrap the object.

Interface and Naming Convention

The naming convention used for interface functions is:

  • xxxx - Base xxxx operation that creates a new tile object from the input arguments.
  • xxxx_to - Base xxxx operation that modifies the first argument or calling object in-place (without constructing an new object).

where xxxx represent the arithmetic/mutating operation performed by the interface function, which includes:

  • add
  • subt
  • mult
  • scal
  • gemm
  • neg
  • shift

There are additional functions supporting generic unary and binary element-wise operations:

  • unary
  • inplace_unary
  • binary
  • inplace_binary

There are multiple overloaded version of these function, which combine scaling, permuting, or scaling and permuting operations with the base arithmetic/mutating operation.

In the following sections, TensorType is used to represent an arbitrary user-defined tile type that meets the minimum requirements specified above. ScalarType is used to represent an built-in scalar data type (e.g. int, float, etc.). The example code below is used for demonstration purposes and may not be the an optimal solution.

Required Functions

The minimum set of functions required are:

  • empty
  • clone
  • permute
  • scale

These functions are necessary for all tile operations.

Empty

The empty function checks that the tile object has been initialized and is usable in arithmetic operations. It returns true if the tile has not been initialized, otherwise false. It is possible for empty to always return false, if the tile type does not support default construction (or uninitialized) objects.

Non-intrusive interface:

bool empty(const TensorType& tensor);

Intrusive interface:

Clone

The clone function creates a "deep" copy of a tensor, i.e. all data elements of the tile are explicitly copied to a new object.

Non-intrusive interface:

TensorType clone(const TensorType& tensor);

Intrusive interface:

TensorType TensorType::clone();

Permute

The permute function reorders the data of an input tile by swapping the indices in the output tile. For example, the transpose of a matrix is the equivalent of permutation P(1,0), where indices 0 and 1 are swapped. The implementation of permute must support arbitrary permutations up to the highest rank supported by the tile type.

Non-intrusive interface:

TensorType permute(const TensorType& arg, const TiledArray::Permutation&
perm);

Intrusive interface:

Example:

The following code constructs a permuted copy of the argument. The example code assumes TensorType has a range() member function that returns a TiledArray::Range object. However, this is an implementation detail that is not necessary.

TensorType
permute(const TensorType& arg, const TiledArray::Permutation& perm) {
// Get tile boundaries
const auto lobound = arg.range().lobound();
const auto upbound = arg.range().upbound();
// Construct the result tile with a permuted range
TensorType result(perm * arg.range());
// Iterate over tile elements
for(auto it = arg.range().begin(); it < arg.range().end(); ++it) {
// Get the coordinate index of the argument and the result element
const auto index = it.index();
const auto perm_index = perm * it.index();
result(perm_index) = arg(index);
}
return result;
}

Scale

The scale interface consists of two function groups scale and scale_to.

Non-intrusive interface:

TensorType scale(const TensorType& arg, const ScalarType factor); // (1)
TensorType scale(const TensorType& arg, const ScalarType factor, // (2)
TensorType& scale_to(TensorType& arg, const ScalarType factor); // (3)

Intrusive interface:

TensorType TensorType::scale(const ScalarType factor); // (1)
TensorType TensorType::scale(const ScalarType factor, // (2)
TensorType& TensorType::scale_to(const ScalarType factor); // (3)

Function (1) creates a copy of the argument tensor that is scaled by factor, (2) creates a copy of the argument tensor that is scaled by factor and permuted by perm, and (3) scales the argument tensor in-place (without creating a copy).

Example:

TensorType
scale(const TensorType& arg, const ScalarType factor) {
// Construct the result tile
TensorType result(arg.range());
std::transform(arg.begin(), arg.end(), result.begin(),
[] (const TensorType& value) { return value * factor; });
return result;
}

Tile Addition Interface

The tile addition interface include several functions, which are required for to implement simple addition operations.

Typedef Documentation

◆ result_of_abs_max_t

template<typename T >
using TiledArray::result_of_abs_max_t = typedef decltype(abs_max(std::declval<T>()))

Definition at line 998 of file tile_interface.h.

◆ result_of_abs_min_t

template<typename T >
using TiledArray::result_of_abs_min_t = typedef decltype(abs_min(std::declval<T>()))

Definition at line 1001 of file tile_interface.h.

◆ result_of_binary_t

template<typename... T>
using TiledArray::result_of_binary_t = typedef decltype(binary(std::declval<T>()...))

Definition at line 568 of file tile_interface.h.

◆ result_of_conj_t

template<typename... T>
using TiledArray::result_of_conj_t = typedef decltype(conj(std::declval<T>()...))

Definition at line 697 of file tile_interface.h.

◆ result_of_conj_to_t

template<typename... T>
using TiledArray::result_of_conj_to_t = typedef decltype(conj_to(std::declval<T>()...))

Definition at line 700 of file tile_interface.h.

◆ result_of_dot_t

template<typename L , typename R >
using TiledArray::result_of_dot_t = typedef decltype(dot(std::declval<L>(), std::declval<R>()))

Definition at line 1004 of file tile_interface.h.

◆ result_of_gemm_t

template<typename... T>
using TiledArray::result_of_gemm_t = typedef decltype(gemm(std::declval<T>()...))

Definition at line 845 of file tile_interface.h.

◆ result_of_inplace_binary_t

template<typename... T>
using TiledArray::result_of_inplace_binary_t = typedef decltype(inplace_binary(std::declval<T>()...))

Definition at line 571 of file tile_interface.h.

◆ result_of_inplace_unary_t

template<typename... T>
using TiledArray::result_of_inplace_unary_t = typedef decltype(inplace_unary(std::declval<T>()...))

Definition at line 753 of file tile_interface.h.

◆ result_of_max_t

template<typename T >
using TiledArray::result_of_max_t = typedef decltype(max(std::declval<T>()))

Definition at line 992 of file tile_interface.h.

◆ result_of_min_t

template<typename T >
using TiledArray::result_of_min_t = typedef decltype(min(std::declval<T>()))

Definition at line 995 of file tile_interface.h.

◆ result_of_mult_t

template<typename... T>
using TiledArray::result_of_mult_t = typedef decltype(mult(std::declval<T>()...))

Definition at line 507 of file tile_interface.h.

◆ result_of_mult_to_t

template<typename... T>
using TiledArray::result_of_mult_to_t = typedef decltype(mult_to(std::declval<T>()...))

Definition at line 510 of file tile_interface.h.

◆ result_of_neg_t

template<typename... T>
using TiledArray::result_of_neg_t = typedef decltype(neg(std::declval<T>()...))

Definition at line 613 of file tile_interface.h.

◆ result_of_neg_to_t

template<typename... T>
using TiledArray::result_of_neg_to_t = typedef decltype(neg_to(std::declval<T>()...))

Definition at line 616 of file tile_interface.h.

◆ result_of_norm_t

template<typename T , typename ResultType = T>
using TiledArray::result_of_norm_t = typedef decltype(norm(std::declval<T>(), std::declval<ResultType&>()))

Definition at line 988 of file tile_interface.h.

◆ result_of_product_t

template<typename T >
using TiledArray::result_of_product_t = typedef decltype(product(std::declval<T>()))

Definition at line 982 of file tile_interface.h.

◆ result_of_squared_norm_t

template<typename T >
using TiledArray::result_of_squared_norm_t = typedef decltype(squared_norm(std::declval<T>()))

Definition at line 985 of file tile_interface.h.

◆ result_of_subt_t

template<typename... T>
using TiledArray::result_of_subt_t = typedef decltype(subt(std::declval<T>()...))

Definition at line 410 of file tile_interface.h.

◆ result_of_subt_to_t

template<typename... T>
using TiledArray::result_of_subt_to_t = typedef decltype(subt_to(std::declval<T>()...))

Definition at line 413 of file tile_interface.h.

◆ result_of_sum_t

template<typename T >
using TiledArray::result_of_sum_t = typedef decltype(sum(std::declval<T>()))

Definition at line 979 of file tile_interface.h.

◆ result_of_unary_t

template<typename... T>
using TiledArray::result_of_unary_t = typedef decltype(unary(std::declval<T>()...))

Definition at line 750 of file tile_interface.h.

Function Documentation

◆ abs_max()

template<typename Arg >
auto TiledArray::abs_max ( const Arg &  arg)
inline

Absolute maximum element of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to find the maximum
Returns
A scalar that is equal to abs(max(arg))

Definition at line 937 of file tile_interface.h.

◆ abs_min()

template<typename Arg >
auto TiledArray::abs_min ( const Arg &  arg)
inline

Absolute mainimum element of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to find the minimum
Returns
A scalar that is equal to abs(min(arg))

Definition at line 947 of file tile_interface.h.

◆ binary() [1/2]

template<typename Left , typename Right , typename Op >
decltype(auto) TiledArray::binary ( const Left &  left,
const Right &  right,
Op &&  op 
)
inline

Binary element-wise transform producing a new tile.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
OpAn element-wise operation type
Parameters
[in]leftThe left-hand argument to the transform
[in]rightThe right-hand argument to the transform
opAn element-wise operation
Returns
result where for each i in left.range() result[i]==op(left[i],right[i])

Definition at line 527 of file tile_interface.h.

◆ binary() [2/2]

template<typename Left , typename Right , typename Op , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
decltype(auto) TiledArray::binary ( const Left &  left,
const Right &  right,
Op &&  op,
const Perm &  perm 
)
inline

Binary element-wise transform producing a new tile.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
OpAn element-wise operation type
PermA permutation type
Parameters
[in]leftThe left-hand argument to the transform
[in]rightThe right-hand argument to the transform
opAn element-wise operation
permThe permutation to be applied to the result
Returns
perm^result where for each i in left.range() result[i]==op(left[i],right[i])

Definition at line 546 of file tile_interface.h.

◆ conj() [1/4]

template<typename Arg >
auto TiledArray::conj ( const Arg &  arg)
inline

Create a complex conjugated copy of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe tile to be conjugated
Returns
A complex conjugated copy of arg

Definition at line 626 of file tile_interface.h.

◆ conj() [2/4]

template<typename Arg , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
auto TiledArray::conj ( const Arg &  arg,
const Perm &  perm 
)
inline

Create a complex conjugated and permuted copy of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe tile to be conjugated
permThe permutation to be applied to arg
Returns
A complex conjugated and permuted copy of arg

Definition at line 652 of file tile_interface.h.

◆ conj() [3/4]

template<typename Arg , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric_v< Scalar >>::type * = nullptr>
auto TiledArray::conj ( const Arg &  arg,
const Scalar  factor 
)
inline

Create a complex conjugated and scaled copy of a tile.

Template Parameters
ArgThe tile argument type
ScalarA scalar type
Parameters
argThe tile to be conjugated
factorThe scaling factor
Returns
A complex conjugated and scaled copy of arg

Definition at line 640 of file tile_interface.h.

◆ conj() [4/4]

template<typename Arg , typename Scalar , typename Perm , typename std::enable_if< TiledArray::detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
auto TiledArray::conj ( const Arg &  arg,
const Scalar  factor,
const Perm &  perm 
)
inline

Create a complex conjugated, scaled, and permuted copy of a tile.

Template Parameters
ArgThe tile argument type
ScalarA scalar type
Parameters
argThe argument to be conjugated
factorThe scaling factor
permThe permutation to be applied to arg
Returns
A complex conjugated, scaled, and permuted copy of arg

Definition at line 668 of file tile_interface.h.

◆ conj_to() [1/2]

template<typename Result >
Result& TiledArray::conj_to ( Result &  result)
inline

In-place complex conjugate a tile.

Template Parameters
ResultThe tile type
Parameters
resultThe tile to be conjugated
Returns
A reference to result

Definition at line 678 of file tile_interface.h.

◆ conj_to() [2/2]

template<typename Result , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric_v< Scalar >>::type * = nullptr>
Result& TiledArray::conj_to ( Result &  result,
const Scalar  factor 
)
inline

In-place complex conjugate and scale a tile.

Template Parameters
ResultThe tile type
ScalarA scalar type
Parameters
resultThe tile to be conjugated
factorThe scaling factor
Returns
A reference to result

Definition at line 692 of file tile_interface.h.

◆ dot()

template<typename Left , typename Right >
auto TiledArray::dot ( const Left &  left,
const Right &  right 
)
inline

Vector dot product of two tiles.

Template Parameters
LeftThe left-hand argument tile type
RightThe right-hand argument tile type
Parameters
leftThe left-hand argument tile
rightThe right-hand argument tile
Returns
A scalar that is equal to sum_i left[i] * right[i]

Definition at line 959 of file tile_interface.h.

◆ gemm() [1/3]

template<typename Left , typename Right , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
auto TiledArray::gemm ( const Left &  left,
const Right &  right,
const Scalar  factor,
const math::GemmHelper gemm_config 
)
inline

Contract 2 tensors over head/tail modes and scale the product.

The contraction is done via a GEMM operation with fused indices as defined by gemm_config.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
ScalarA scalar type
Parameters
leftThe left-hand argument to be contracted
rightThe right-hand argument to be contracted
factorThe scaling factor
gemm_configA helper object used to simplify gemm operations
Returns
A tile that is equal to (left * right) * factor

Definition at line 771 of file tile_interface.h.

◆ gemm() [2/3]

template<typename Result , typename Left , typename Right , typename ElementMultiplyAddOp , std::enable_if_t< std::is_invocable_r_v< void, std::remove_reference_t< ElementMultiplyAddOp >, typename Result::value_type &, const typename Left::value_type &, const typename Right::value_type & >> * = nullptr>
Result& TiledArray::gemm ( Result &  result,
const Left &  left,
const Right &  right,
const math::GemmHelper gemm_config,
ElementMultiplyAddOp &&  element_multiplyadd_op 
)
inline

Definition at line 836 of file tile_interface.h.

◆ gemm() [3/3]

template<typename Result , typename Left , typename Right , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
Result& TiledArray::gemm ( Result &  result,
const Left &  left,
const Right &  right,
const Scalar  factor,
const math::GemmHelper gemm_config 
)
inline

Contract 2 tensors over head/tail modes, scale the product, and add to result 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
ScalarA numeric type
Parameters
resultThe contracted result
leftThe left-hand argument to be contracted
rightThe right-hand argument to be contracted
factorThe scaling factor
gemm_configA helper object used to simplify gemm operations
Returns
A tile that is equal to result + (left * right) * factor

Definition at line 793 of file tile_interface.h.

◆ inner_product()

template<typename Left , typename Right >
auto TiledArray::inner_product ( const Left &  left,
const Right &  right 
)
inline

Vector inner product of two tiles.

Template Parameters
LeftThe left-hand argument tile type
RightThe right-hand argument tile type
Parameters
leftThe left-hand argument tile
rightThe right-hand argument tile
Returns
A scalar that is equal to sum_i conj(left[i]) * right[i]

Definition at line 971 of file tile_interface.h.

◆ inplace_binary()

template<typename Left , typename Right , typename Op >
Left& TiledArray::inplace_binary ( Left &  left,
const Right &  right,
Op &&  op 
)
inline

Binary element-wise in-place transform.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
OpAn element-wise operation type
Parameters
[in,out]leftThe left-hand argument to the transform; output contains the result of binary(left,right,op)
[in]rightThe right-hand argument to the transform
opAn element-wise operation
Returns
reference to left

Definition at line 563 of file tile_interface.h.

◆ inplace_unary()

template<typename Result , typename Op >
Result& TiledArray::inplace_unary ( Result &  arg,
Op &&  op 
)
inline

Unary element-wise in-place transform.

Template Parameters
ArgThe tile argument type
OpAn element-wise operation type
Parameters
[in,out]argThe tile to be transformed, on output for each i in arg.range() arg[i] contains op(arg[i])
opAn element-wise operation
Returns
reference to arg

Definition at line 745 of file tile_interface.h.

◆ max()

template<typename Arg >
auto TiledArray::max ( const Arg &  arg)
inline

Maximum element of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to find the maximum
Returns
A scalar that is equal to max(arg)

Definition at line 917 of file tile_interface.h.

◆ min()

template<typename Arg >
auto TiledArray::min ( const Arg &  arg)
inline

Minimum element of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to find the minimum
Returns
A scalar that is equal to min(arg)

Definition at line 927 of file tile_interface.h.

◆ mult() [1/4]

template<typename Left , typename Right >
auto TiledArray::mult ( const Left &  left,
const Right &  right 
)
inline

Multiplication tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
Parameters
leftThe left-hand argument to be multiplied
rightThe right-hand argument to be multiplied
Returns
A tile that is equal to (left * right)

Definition at line 425 of file tile_interface.h.

◆ mult() [2/4]

template<typename Left , typename Right , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm> && detail::has_member_function_mult_anyreturn_v< const Left, const Right&, const Perm&>>>
auto TiledArray::mult ( const Left &  left,
const Right &  right,
const Perm &  perm 
)
inline

Multiplication and permute tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
Parameters
leftThe left-hand argument to be multiplied
rightThe right-hand argument to be multiplied
permThe permutation to be applied to the result
Returns
A tile that is equal to perm ^ (left * right)

Definition at line 457 of file tile_interface.h.

◆ mult() [3/4]

template<typename Left , typename Right , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
auto TiledArray::mult ( const Left &  left,
const Right &  right,
const Scalar  factor 
)
inline

Multiplication and scale tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
ScalarA scalar type
Parameters
leftThe left-hand argument to be multiplied
rightThe right-hand argument to be multiplied
factorThe scaling factor
Returns
A tile that is equal to (left * right) * factor

Definition at line 440 of file tile_interface.h.

◆ mult() [4/4]

template<typename Left , typename Right , typename Scalar , typename Perm , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >> * = nullptr>
auto TiledArray::mult ( const Left &  left,
const Right &  right,
const Scalar  factor,
const Perm &  perm 
)
inline

Multiplication, scale, and permute tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
ScalarA scalar type
Parameters
leftThe left-hand argument to be multiplied
rightThe right-hand argument to be multiplied
factorThe scaling factor
permThe permutation to be applied to the result
Returns
A tile that is equal to perm ^ (left * right) * factor

Definition at line 474 of file tile_interface.h.

◆ mult_to() [1/2]

template<typename Result , typename Arg >
Result& TiledArray::mult_to ( Result &  result,
const Arg &  arg 
)
inline

Multiply to the result tile.

Template Parameters
ResultThe result tile type
ArgThe argument tile type
Parameters
resultThe result tile to be multiplied
argThe argument to be multiplied by the result
Returns
A tile that is equal to result *= arg

Definition at line 487 of file tile_interface.h.

◆ mult_to() [2/2]

template<typename Result , typename Arg , typename Scalar , std::enable_if_t< TiledArray::detail::is_numeric_v< Scalar >> * = nullptr>
Result& TiledArray::mult_to ( Result &  result,
const Arg &  arg,
const Scalar  factor 
)
inline

Multiply and scale to the result tile.

Template Parameters
ResultThe result tile type
ArgThe argument tile type
ScalarA scalar type
Parameters
resultThe result tile to be multiplied
argThe argument to be multiplied by result
factorThe scaling factor
Returns
A tile that is equal to (result *= arg) *= factor

Definition at line 502 of file tile_interface.h.

◆ neg() [1/2]

template<typename Arg >
auto TiledArray::neg ( const Arg &  arg)
inline

Negate the tile argument.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to be negated
Returns
A tile that is equal to -arg

Definition at line 586 of file tile_interface.h.

◆ neg() [2/2]

template<typename Arg , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
auto TiledArray::neg ( const Arg &  arg,
const Perm &  perm 
)
inline

Negate and permute tile argument.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to be negated
permThe permutation to be applied to the result
Returns
A tile that is equal to perm ^ -arg

Definition at line 598 of file tile_interface.h.

◆ neg_to()

template<typename Result >
Result& TiledArray::neg_to ( Result &  result)
inline

Negate the tile argument in-place.

Template Parameters
ResultThe result tile type
Parameters
resultThe result tile to be negated
Returns
Reference to result

Definition at line 608 of file tile_interface.h.

◆ norm() [1/2]

template<typename Arg >
auto TiledArray::norm ( const Arg &  arg)
inline

Vector 2-norm of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to be multiplied and summed
Returns
A scalar that is equal to sqrt(sum_i arg[i] * arg[i])

Definition at line 896 of file tile_interface.h.

◆ norm() [2/2]

template<typename Arg , typename ResultType >
void TiledArray::norm ( const Arg &  arg,
ResultType &  result 
)
inline

Vector 2-norm of a tile.

Template Parameters
ArgThe tile argument type
ResultTypeThe result type
Parameters
argThe argument to be multiplied and summed
Returns
A scalar that is equal to sqrt(sum_i arg[i] * arg[i])

Definition at line 907 of file tile_interface.h.

◆ product()

template<typename Arg >
auto TiledArray::product ( const Arg &  arg)
inline

Multiply the elements of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to be multiplied
Returns
A scalar that is equal to prod_i arg[i]

Definition at line 875 of file tile_interface.h.

◆ squared_norm()

template<typename Arg >
auto TiledArray::squared_norm ( const Arg &  arg)
inline

Squared vector 2-norm of the elements of a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to be multiplied and summed
Returns
The sum of the squared elements of arg
A scalar that is equal to sum_i arg[i] * arg[i]

Definition at line 886 of file tile_interface.h.

◆ subt() [1/6]

template<typename Arg , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
auto TiledArray::subt ( const Arg &  arg,
const Scalar  value 
)
inline

Subtract a scalar constant from the tile argument.

Template Parameters
ArgThe tile argument type
ScalarA scalar type
Parameters
argThe left-hand argument to be subtracted
valueThe constant scalar to be subtracted
Returns
A tile that is equal to arg - value

Definition at line 347 of file tile_interface.h.

◆ subt() [2/6]

template<typename Arg , typename Scalar , typename Perm , typename std::enable_if< detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
auto TiledArray::subt ( const Arg &  arg,
const Scalar  value,
const Perm &  perm 
)
inline

Subtract a constant scalar and permute tile argument.

Template Parameters
ArgThe tile argument type
ScalarA scalar type
Parameters
argThe left-hand argument to be subtracted
valueThe constant scalar value to be subtracted
permThe permutation to be applied to the result
Returns
A tile that is equal to perm ^ (arg - value)

Definition at line 363 of file tile_interface.h.

◆ subt() [3/6]

template<typename Left , typename Right >
auto TiledArray::subt ( const Left &  left,
const Right &  right 
)
inline

Subtract tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
Parameters
leftThe left-hand argument to be subtracted
rightThe right-hand argument to be subtracted
Returns
A tile that is equal to (left - right)

Definition at line 284 of file tile_interface.h.

◆ subt() [4/6]

template<typename Left , typename Right , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
auto TiledArray::subt ( const Left &  left,
const Right &  right,
const Perm &  perm 
)
inline

Subtract and permute tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
Parameters
leftThe left-hand argument to be subtracted
rightThe right-hand argument to be subtracted
permThe permutation to be applied to the result
Returns
A tile that is equal to perm ^ (left - right)

Definition at line 314 of file tile_interface.h.

◆ subt() [5/6]

template<typename Left , typename Right , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
auto TiledArray::subt ( const Left &  left,
const Right &  right,
const Scalar  factor 
)
inline

Subtract and scale tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
ScalarA scalar type
Parameters
leftThe left-hand argument to be subtracted
rightThe right-hand argument to be subtracted
factorThe scaling factor
Returns
A tile that is equal to (left - right) * factor

Definition at line 300 of file tile_interface.h.

◆ subt() [6/6]

template<typename Left , typename Right , typename Scalar , typename Perm , typename std::enable_if< detail::is_numeric_v< Scalar > &&detail::is_permutation_v< Perm >>::type * = nullptr>
auto TiledArray::subt ( const Left &  left,
const Right &  right,
const Scalar  factor,
const Perm &  perm 
)
inline

Subtract, scale, and permute tile arguments.

Template Parameters
LeftThe left-hand tile type
RightThe right-hand tile type
ScalarA scalar type
Parameters
leftThe left-hand argument to be subtracted
rightThe right-hand argument to be subtracted
factorThe scaling factor
permThe permutation to be applied to the result
Returns
A tile that is equal to perm ^ (left - right) * factor

Definition at line 332 of file tile_interface.h.

◆ subt_to() [1/3]

template<typename Result , typename Arg >
Result& TiledArray::subt_to ( Result &  result,
const Arg &  arg 
)
inline

Subtract from the result tile.

Template Parameters
ResultThe result tile type
ArgThe argument tile type
Parameters
resultThe result tile
argThe argument to be subtracted from the result
Returns
A tile that is equal to result[i] -= arg[i]

Definition at line 375 of file tile_interface.h.

◆ subt_to() [2/3]

template<typename Result , typename Arg , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
Result& TiledArray::subt_to ( Result &  result,
const Arg &  arg,
const Scalar  factor 
)
inline

Subtract and scale from the result tile.

Template Parameters
ResultThe result tile type
ArgThe argument tile type
ScalarA scalar type
Parameters
resultThe result tile
argThe argument to be subtracted from result
factorThe scaling factor
Returns
A tile that is equal to (result -= arg) *= factor

Definition at line 391 of file tile_interface.h.

◆ subt_to() [3/3]

template<typename Result , typename Scalar , typename std::enable_if< detail::is_numeric_v< Scalar >>::type * = nullptr>
Result& TiledArray::subt_to ( Result &  result,
const Scalar  value 
)
inline

Subtract constant scalar from the result tile.

Template Parameters
ResultThe result tile type
ScalarA scalar type
Parameters
resultThe result tile
valueThe constant scalar to be subtracted from result
Returns
A tile that is equal to (result -= arg) *= factor

Definition at line 405 of file tile_interface.h.

◆ sum()

template<typename Arg >
auto TiledArray::sum ( const Arg &  arg)
inline

Sum the hyper-diagonal elements a tile.

Template Parameters
ArgThe tile argument type
Parameters
argThe argument to be summed
Returns
The sum of the hyper-diagonal elements of arg Sum the elements of a tile
Template Parameters
ArgThe tile argument type
Parameters
argThe argument to be summed
Returns
A scalar that is equal to sum_i arg[i]

Definition at line 865 of file tile_interface.h.

◆ unary() [1/2]

template<typename Arg , typename Op >
decltype(auto) TiledArray::unary ( const Arg &  arg,
Op &&  op 
)
inline

Unary element-wise transform producing a new tile.

Template Parameters
ArgThe tile argument type
OpAn element-wise operation type
Parameters
[in]argThe tile to be transformed
opAn element-wise operation
Returns
result where for each i in arg.range() result[i]==op(arg[i])

Definition at line 715 of file tile_interface.h.

◆ unary() [2/2]

template<typename Arg , typename Op , typename Perm , typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
decltype(auto) TiledArray::unary ( const Arg &  arg,
Op &&  op,
const Perm &  perm 
)
inline

Unary element-wise transform producing a new tile.

Template Parameters
ArgThe tile argument type
OpAn element-wise operation type
Parameters
[in]argThe tile to be transformed
opAn element-wise operation
permThe permutation to be applied to the result of the transform
Returns
perm^result where for each i in arg.range() result[i]==op(arg[i])

Definition at line 731 of file tile_interface.h.

std::enable_if<!TiledArray::detail::is_permutation_v< Perm >, TiledArray::Range >::type permute(const TiledArray::Range &r, const Perm &p)
Definition: btas.h:803
Tile< Result > & scale_to(Tile< Result > &result, const Scalar factor)
Scale to the result tile.
Definition: tile.h:1204
Permutation of a sequence of objects indexed by base-0 indices.
Definition: permutation.h:130
DistArray< Tile, Policy > clone(const DistArray< Tile, Policy > &arg)
Create a deep copy of an array.
Definition: clone.h:43
KroneckerDeltaTile< N > permute(const KroneckerDeltaTile< N > &tile, const Perm &perm)
decltype(auto) scale(const btas::Tensor< T, Range, Storage > &result, const Scalar factor)
Definition: btas.h:476
decltype(auto) scale(const Tile< Arg > &arg, const Scalar factor)
Scalar the tile argument.
Definition: tile.h:1174
constexpr bool empty()
Test for empty tensors in an empty list.
Definition: utility.h:320
bool empty(const Tile< Arg > &arg)
Check that arg is empty (no data)
Definition: tile.h:646
btas::Tensor< T, Range, Storage > & scale_to(btas::Tensor< T, Range, Storage > &result, const Scalar factor)
Definition: btas.h:467