TiledArray
0.7.0
|
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_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_gemm_t = decltype(gemm(std::declval< T >()...)) |
template<typename T > | |
using | TiledArray::result_of_trace_t = decltype(mult(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 > | |
using | TiledArray::result_of_norm_t = decltype(norm(std::declval< T >())) |
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 Arg > | |
bool | TiledArray::empty (const Arg &arg) |
Check that arg is empty (no data) More... | |
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< Scalar >::value >::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 > | |
auto | TiledArray::subt (const Left &left, const Right &right, const Permutation &perm) |
Subtract and permute tile arguments. More... | |
template<typename Left , typename Right , typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr> | |
auto | TiledArray::subt (const Left &left, const Right &right, const Scalar factor, const Permutation &perm) |
Subtract, scale, and permute tile arguments. More... | |
template<typename Arg , typename Scalar , typename std::enable_if< detail::is_numeric< Scalar >::value >::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 std::enable_if< detail::is_numeric< Scalar >::value >::type * = nullptr> | |
auto | TiledArray::subt (const Arg &arg, const Scalar value, const Permutation &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< Scalar >::value >::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< Scalar >::value >::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 , typename std::enable_if< TiledArray::detail::is_numeric< Scalar >::value >::type * = nullptr> | |
auto | TiledArray::mult (const Left &left, const Right &right, const Scalar factor) |
Multiplication and scale tile arguments. More... | |
template<typename Left , typename Right > | |
auto | TiledArray::mult (const Left &left, const Right &right, const Permutation &perm) |
Multiplication and permute tile arguments. More... | |
template<typename Left , typename Right , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric< Scalar >::value >::type * = nullptr> | |
auto | TiledArray::mult (const Left &left, const Right &right, const Scalar factor, const Permutation &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 , typename std::enable_if< TiledArray::detail::is_numeric< Scalar >::value >::type * = nullptr> | |
Result & | TiledArray::mult_to (Result &result, const Arg &arg, const Scalar factor) |
Multiply and scale to the result tile. More... | |
template<typename Arg > | |
auto | TiledArray::neg (const Arg &arg) |
Negate the tile argument. More... | |
template<typename Arg > | |
auto | TiledArray::neg (const Arg &arg, const Permutation &perm) |
Negate and permute tile argument. More... | |
template<typename Result > | |
Result & | TiledArray::neg_to (Result &result) |
Multiplication constant scalar to a tile. 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< Scalar >::value >::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 > | |
auto | TiledArray::conj (const Arg &arg, const Permutation &perm) |
Create a complex conjugated and permuted copy of a tile. More... | |
template<typename Arg , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric< Scalar >::value >::type * = nullptr> | |
auto | TiledArray::conj (const Arg &arg, const Scalar factor, const Permutation &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< Scalar >::value >::type * = nullptr> | |
Result & | TiledArray::conj_to (Result &result, const Scalar factor) |
In-place complex conjugate and scale a tile. More... | |
template<typename Left , typename Right , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric< Scalar >::value >::type * = nullptr> | |
auto | TiledArray::gemm (const Left &left, const Right &right, const Scalar factor, const math::GemmHelper &gemm_config) |
Contract and scale tile arguments. More... | |
template<typename Result , typename Left , typename Right , typename Scalar , typename std::enable_if< TiledArray::detail::is_numeric< Scalar >::value >::type * = nullptr> | |
Result & | TiledArray::gemm (Result &result, const Left &left, const Right &right, const Scalar factor, const math::GemmHelper &gemm_config) |
Contract and scale tile arguments to the result tile. More... | |
template<typename Arg > | |
auto | TiledArray::trace (const Arg &arg) |
Sum the hyper-diagonal elements a tile. More... | |
template<typename Arg > | |
auto | TiledArray::sum (const Arg &arg) |
Sum the elements of 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 > | |
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... | |
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).
The minimum requirements for user defined tile types are:
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.
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 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.
The minimum set of functions required are:
empty
clone
permute
scale
These functions are necessary for all tile operations.
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:
Intrusive interface:
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:
Intrusive interface:
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:
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.
The scale interface consists of two function groups scale
and scale_to
.
Non-intrusive interface:
Intrusive interface:
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 permtued by perm
, and (3) scales the argument tensor in-place (without creating a copy).
Example:
The tile addition interface include several functions, which are required for to implement simple addition operations.
using TiledArray::result_of_abs_max_t = typedef decltype(abs_max(std::declval<T>())) |
Definition at line 785 of file tile_interface.h.
using TiledArray::result_of_abs_min_t = typedef decltype(abs_min(std::declval<T>())) |
Definition at line 788 of file tile_interface.h.
using TiledArray::result_of_conj_t = typedef decltype(conj(std::declval<T>()...)) |
Definition at line 605 of file tile_interface.h.
using TiledArray::result_of_conj_to_t = typedef decltype(conj_to(std::declval<T>()...)) |
Definition at line 608 of file tile_interface.h.
using TiledArray::result_of_dot_t = typedef decltype(dot(std::declval<L>(), std::declval<R>())) |
Definition at line 791 of file tile_interface.h.
using TiledArray::result_of_gemm_t = typedef decltype(gemm(std::declval<T>()...)) |
Definition at line 655 of file tile_interface.h.
using TiledArray::result_of_max_t = typedef decltype(max(std::declval<T>())) |
Definition at line 779 of file tile_interface.h.
using TiledArray::result_of_min_t = typedef decltype(min(std::declval<T>())) |
Definition at line 782 of file tile_interface.h.
using TiledArray::result_of_mult_t = typedef decltype(mult(std::declval<T>()...)) |
Definition at line 483 of file tile_interface.h.
using TiledArray::result_of_mult_to_t = typedef decltype(mult_to(std::declval<T>()...)) |
Definition at line 486 of file tile_interface.h.
using TiledArray::result_of_neg_t = typedef decltype(neg(std::declval<T>()...)) |
Definition at line 522 of file tile_interface.h.
using TiledArray::result_of_neg_to_t = typedef decltype(neg_to(std::declval<T>()...)) |
Definition at line 525 of file tile_interface.h.
using TiledArray::result_of_norm_t = typedef decltype(norm(std::declval<T>())) |
Definition at line 776 of file tile_interface.h.
using TiledArray::result_of_product_t = typedef decltype(product(std::declval<T>())) |
Definition at line 770 of file tile_interface.h.
using TiledArray::result_of_squared_norm_t = typedef decltype(squared_norm(std::declval<T>())) |
Definition at line 773 of file tile_interface.h.
using TiledArray::result_of_subt_t = typedef decltype(subt(std::declval<T>()...)) |
Definition at line 393 of file tile_interface.h.
using TiledArray::result_of_subt_to_t = typedef decltype(subt_to(std::declval<T>()...)) |
Definition at line 396 of file tile_interface.h.
using TiledArray::result_of_sum_t = typedef decltype(sum(std::declval<T>())) |
Definition at line 767 of file tile_interface.h.
using TiledArray::result_of_trace_t = typedef decltype(mult(std::declval<T>())) |
Definition at line 764 of file tile_interface.h.
|
inline |
Absolute maximum element of a tile.
Arg | The tile argument type |
arg | The argument to find the maximum |
abs(max(arg))
Definition at line 729 of file tile_interface.h.
|
inline |
Absolute mainimum element of a tile.
Arg | The tile argument type |
arg | The argument to find the minimum |
abs(min(arg))
Definition at line 738 of file tile_interface.h.
|
inline |
Create a complex conjugated copy of a tile.
Arg | The tile argument type |
arg | The tile to be conjugated |
arg
Definition at line 536 of file tile_interface.h.
|
inline |
Create a complex conjugated and scaled copy of a tile.
Arg | The tile argument type |
Scalar | A scalar type |
arg | The tile to be conjugated |
factor | The scaling factor |
arg
Definition at line 550 of file tile_interface.h.
|
inline |
Create a complex conjugated and permuted copy of a tile.
Arg | The tile argument type |
arg | The tile to be conjugated |
perm | The permutation to be applied to arg |
arg
Definition at line 560 of file tile_interface.h.
|
inline |
Create a complex conjugated, scaled, and permuted copy of a tile.
Arg | The tile argument type |
Scalar | A scalar type |
arg | The argument to be conjugated |
factor | The scaling factor |
perm | The permutation to be applied to arg |
arg
Definition at line 575 of file tile_interface.h.
|
inline |
In-place complex conjugate a tile.
Result | The tile type |
result | The tile to be conjugated |
result
Definition at line 584 of file tile_interface.h.
|
inline |
In-place complex conjugate and scale a tile.
Result | The tile type |
Scalar | A scalar type |
result | The tile to be conjugated |
factor | The scaling factor |
result
Definition at line 599 of file tile_interface.h.
|
inline |
Vector dot product of two tiles.
Left | The left-hand argument tile type |
Right | The right-hand argument tile type |
left | The left-hand argument tile |
right | The right-hand argument tile |
sum_i left[i] * right[i]
Definition at line 749 of file tile_interface.h.
|
inline |
Check that arg
is empty (no data)
Arg | The tile argument type |
arg | The tile argument to be checked |
true
if arg
is empty, otherwise false
. Definition at line 267 of file tile_interface.h.
|
inline |
Contract and scale tile arguments.
The contraction is done via a GEMM operation with fused indices as defined by gemm_config
.
Left | The left-hand tile type |
Right | The right-hand tile type |
Scalar | A scalar type |
left | The left-hand argument to be contracted |
right | The right-hand argument to be contracted |
factor | The scaling factor |
gemm_config | A helper object used to simplify gemm operations |
(left * right) * factor
Definition at line 627 of file tile_interface.h.
|
inline |
Contract and scale tile arguments to the result tile.
The contraction is done via a GEMM operation with fused indices as defined by gemm_config
.
Result | The result tile type |
Left | The left-hand tile type |
Right | The right-hand tile type |
Scalar | A scalar type |
result | The contracted result |
left | The left-hand argument to be contracted |
right | The right-hand argument to be contracted |
factor | The scaling factor |
gemm_config | A helper object used to simplify gemm operations |
result = (left * right) * factor
Definition at line 647 of file tile_interface.h.
|
inline |
Vector inner product of two tiles.
Left | The left-hand argument tile type |
Right | The right-hand argument tile type |
left | The left-hand argument tile |
right | The right-hand argument tile |
sum_i conj(left[i]) * right[i]
Definition at line 760 of file tile_interface.h.
|
inline |
Maximum element of a tile.
Arg | The tile argument type |
arg | The argument to find the maximum |
max(arg)
Definition at line 711 of file tile_interface.h.
|
inline |
Minimum element of a tile.
Arg | The tile argument type |
arg | The argument to find the minimum |
min(arg)
Definition at line 720 of file tile_interface.h.
|
inline |
Multiplication tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
left | The left-hand argument to be multiplied |
right | The right-hand argument to be multiplied |
(left * right)
Definition at line 409 of file tile_interface.h.
|
inline |
Multiplication and scale tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
Scalar | A scalar type |
left | The left-hand argument to be multiplied |
right | The right-hand argument to be multiplied |
factor | The scaling factor |
(left * right) * factor
Definition at line 423 of file tile_interface.h.
|
inline |
Multiplication and permute tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
left | The left-hand argument to be multiplied |
right | The right-hand argument to be multiplied |
perm | The permutation to be applied to the result |
perm ^ (left * right)
Definition at line 436 of file tile_interface.h.
|
inline |
Multiplication, scale, and permute tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
Scalar | A scalar type |
left | The left-hand argument to be multiplied |
right | The right-hand argument to be multiplied |
factor | The scaling factor |
perm | The permutation to be applied to the result |
perm ^ (left * right) * factor
Definition at line 451 of file tile_interface.h.
|
inline |
Multiply to the result tile.
Result | The result tile type |
Arg | The argument tile type |
result | The result tile to be multiplied |
arg | The argument to be multiplied by the result |
result *= arg
Definition at line 463 of file tile_interface.h.
|
inline |
Multiply and scale to the result tile.
Result | The result tile type |
Arg | The argument tile type |
Scalar | A scalar type |
result | The result tile to be multiplied |
arg | The argument to be multiplied by result |
factor | The scaling factor |
(result *= arg) *= factor
Definition at line 477 of file tile_interface.h.
|
inline |
Negate the tile argument.
Arg | The tile argument type |
arg | The argument to be negated |
-arg
Definition at line 498 of file tile_interface.h.
|
inline |
Negate and permute tile argument.
Arg | The tile argument type |
arg | The argument to be negated |
perm | The permutation to be applied to the result |
perm ^ -arg
Definition at line 508 of file tile_interface.h.
|
inline |
Multiplication constant scalar to a tile.
Result | The result tile type |
result | The result tile to be negated |
result = -result
Definition at line 517 of file tile_interface.h.
|
inline |
Vector 2-norm of a tile.
Arg | The tile argument type |
arg | The argument to be multiplied and summed |
sqrt(sum_i arg[i] * arg[i])
Definition at line 702 of file tile_interface.h.
|
inline |
Multiply the elements of a tile.
Arg | The tile argument type |
arg | The argument to be multiplied |
prod_i arg[i]
Definition at line 683 of file tile_interface.h.
|
inline |
Squared vector 2-norm of the elements of a tile.
Arg | The tile argument type |
arg | The argument to be multiplied and summed |
arg
sum_i arg[i] * arg[i]
Definition at line 693 of file tile_interface.h.
|
inline |
Subtract tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
left | The left-hand argument to be subtracted |
right | The right-hand argument to be subtracted |
(left - right)
Definition at line 282 of file tile_interface.h.
|
inline |
Subtract and scale tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
Scalar | A scalar type |
left | The left-hand argument to be subtracted |
right | The right-hand argument to be subtracted |
factor | The scaling factor |
(left - right) * factor
Definition at line 296 of file tile_interface.h.
|
inline |
Subtract and permute tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
left | The left-hand argument to be subtracted |
right | The right-hand argument to be subtracted |
perm | The permutation to be applied to the result |
perm ^ (left - right)
Definition at line 309 of file tile_interface.h.
|
inline |
Subtract, scale, and permute tile arguments.
Left | The left-hand tile type |
Right | The right-hand tile type |
Scalar | A scalar type |
left | The left-hand argument to be subtracted |
right | The right-hand argument to be subtracted |
factor | The scaling factor |
perm | The permutation to be applied to the result |
perm ^ (left - right) * factor
Definition at line 324 of file tile_interface.h.
|
inline |
Subtract a scalar constant from the tile argument.
Arg | The tile argument type |
Scalar | A scalar type |
arg | The left-hand argument to be subtracted |
value | The constant scalar to be subtracted |
arg - value
Definition at line 337 of file tile_interface.h.
|
inline |
Subtract a constant scalar and permute tile argument.
Arg | The tile argument type |
Scalar | A scalar type |
arg | The left-hand argument to be subtracted |
value | The constant scalar value to be subtracted |
perm | The permutation to be applied to the result |
perm ^ (arg - value)
Definition at line 351 of file tile_interface.h.
|
inline |
Subtract from the result tile.
Result | The result tile type |
Arg | The argument tile type |
result | The result tile |
arg | The argument to be subtracted from the result |
result[i] -= arg[i]
Definition at line 362 of file tile_interface.h.
|
inline |
Subtract and scale from the result tile.
Result | The result tile type |
Arg | The argument tile type |
Scalar | A scalar type |
result | The result tile |
arg | The argument to be subtracted from result |
factor | The scaling factor |
(result -= arg) *= factor
Definition at line 376 of file tile_interface.h.
|
inline |
Subtract constant scalar from the result tile.
Result | The result tile type |
Scalar | A scalar type |
result | The result tile |
value | The constant scalar to be subtracted from result |
(result -= arg) *= factor
Definition at line 388 of file tile_interface.h.
|
inline |
Sum the elements of a tile.
Arg | The tile argument type |
arg | The argument to be summed |
sum_i arg[i]
Definition at line 674 of file tile_interface.h.
|
inline |
Sum the hyper-diagonal elements a tile.
Arg | The tile argument type |
arg | The argument to be summed |
arg
Definition at line 665 of file tile_interface.h.