TiledArray
0.7.0
|
Arbitrary sparse shape. More...
#include <sparse_shape.h>
Public Types | |
typedef SparseShape< T > | SparseShape_ |
This object type. More... | |
typedef T | value_type |
The norm value type. More... | |
typedef Tensor< value_type >::size_type | size_type |
Size type. More... | |
Public Member Functions | |
SparseShape () | |
Default constructor. More... | |
SparseShape (const Tensor< value_type > &tile_norms, const TiledRange &trange) | |
Constructor. More... | |
template<typename SparseNormSequence > | |
SparseShape (const SparseNormSequence &tile_norms, const TiledRange &trange) | |
"Sparse" constructor More... | |
SparseShape (World &world, const Tensor< value_type > &tile_norms, const TiledRange &trange) | |
Collective "dense" constructor. More... | |
template<typename SparseNormSequence > | |
SparseShape (World &world, const SparseNormSequence &tile_norms, const TiledRange &trange) | |
Collective "sparse" constructor. More... | |
SparseShape (const SparseShape< T > &other) | |
Copy constructor. More... | |
SparseShape< T > & | operator= (const SparseShape< T > &other) |
Copy assignment operator. More... | |
bool | validate (const Range &range) const |
Validate shape range. More... | |
template<typename Index > | |
bool | is_zero (const Index &i) const |
Check that a tile is zero. More... | |
float | sparsity () const |
Sparsity of the shape. More... | |
template<typename Index > | |
value_type | operator[] (const Index &index) const |
Tile norm accessor. More... | |
template<typename Op > | |
SparseShape_ | transform (Op &&op) const |
Transform the norm tensor with an operation. More... | |
const Tensor< value_type > & | data () const |
Data accessor. More... | |
bool | empty () const |
Initialization check. More... | |
SparseShape_ | mask (const SparseShape_ &mask_shape) const |
Compute union of two shapes. More... | |
template<typename Index > | |
SparseShape | update_block (const Index &lower_bound, const Index &upper_bound, const SparseShape &other) const |
Update sub-block of shape. More... | |
template<typename Index > | |
SparseShape | block (const Index &lower_bound, const Index &upper_bound) const |
Create a copy of a sub-block of the shape. More... | |
template<typename Index , typename Factor > | |
SparseShape | block (const Index &lower_bound, const Index &upper_bound, const Factor factor) const |
Create a scaled sub-block of the shape. More... | |
template<typename Index > | |
SparseShape | block (const Index &lower_bound, const Index &upper_bound, const Permutation &perm) const |
Create a copy of a sub-block of the shape. More... | |
template<typename Index , typename Factor > | |
SparseShape | block (const Index &lower_bound, const Index &upper_bound, const Factor factor, const Permutation &perm) const |
Create a copy of a sub-block of the shape. More... | |
SparseShape_ | perm (const Permutation &perm) const |
Create a permuted shape of this shape. More... | |
template<typename Factor > | |
SparseShape_ | scale (const Factor factor) const |
Scale shape. More... | |
template<typename Factor > | |
SparseShape_ | scale (const Factor factor, const Permutation &perm) const |
Scale and permute shape. More... | |
SparseShape_ | add (const SparseShape_ &other) const |
Add shapes. More... | |
SparseShape_ | add (const SparseShape_ &other, const Permutation &perm) const |
Add and permute shapes. More... | |
template<typename Factor > | |
SparseShape_ | add (const SparseShape_ &other, const Factor factor) const |
Add and scale shapes. More... | |
template<typename Factor > | |
SparseShape_ | add (const SparseShape_ &other, const Factor factor, const Permutation &perm) const |
Add, scale, and permute shapes. More... | |
SparseShape_ | add (value_type value) const |
SparseShape_ | add (const value_type value, const Permutation &perm) const |
SparseShape_ | subt (const SparseShape_ &other) const |
SparseShape_ | subt (const SparseShape_ &other, const Permutation &perm) const |
template<typename Factor > | |
SparseShape_ | subt (const SparseShape_ &other, const Factor factor) const |
template<typename Factor > | |
SparseShape_ | subt (const SparseShape_ &other, const Factor factor, const Permutation &perm) const |
SparseShape_ | subt (const value_type value) const |
SparseShape_ | subt (const value_type value, const Permutation &perm) const |
SparseShape_ | mult (const SparseShape_ &other) const |
SparseShape_ | mult (const SparseShape_ &other, const Permutation &perm) const |
template<typename Factor > | |
SparseShape_ | mult (const SparseShape_ &other, const Factor factor) const |
template<typename Factor > | |
SparseShape_ | mult (const SparseShape_ &other, const Factor factor, const Permutation &perm) const |
template<typename Factor > | |
SparseShape_ | gemm (const SparseShape_ &other, const Factor factor, const math::GemmHelper &gemm_helper) const |
template<typename Factor > | |
SparseShape_ | gemm (const SparseShape_ &other, const Factor factor, const math::GemmHelper &gemm_helper, const Permutation &perm) const |
Static Public Member Functions | |
static constexpr bool | is_dense () |
Check density. More... | |
static value_type | threshold () |
Threshold accessor. More... | |
static void | threshold (const value_type thresh) |
Set threshold to thresh . More... | |
Arbitrary sparse shape.
Sparse shape uses a Tensor
of Frobenius norms to estimate the magnitude of the data contained in tiles of an Array object. Because tiles may have an arbitrary size, the norm data is normalized, internally, by dividing the norms by the number of elements in each tile.
where are tile indices, is norm of tile , and is the product of tile in each dimension.
T | The sparse element value type |
Definition at line 55 of file sparse_shape.h.
typedef Tensor<value_type>::size_type TiledArray::SparseShape< T >::size_type |
Size type.
Definition at line 60 of file sparse_shape.h.
typedef SparseShape<T> TiledArray::SparseShape< T >::SparseShape_ |
This object type.
Definition at line 57 of file sparse_shape.h.
typedef T TiledArray::SparseShape< T >::value_type |
The norm value type.
Definition at line 58 of file sparse_shape.h.
|
inline |
Default constructor.
Construct a shape with no data.
Definition at line 210 of file sparse_shape.h.
|
inline |
Constructor.
This constructor will normalize the tile norm, where the normalization constant for each tile is the inverse of the number of elements in the tile.
tile_norms | The Frobenius norm of tiles |
trange | The tiled range of the tensor |
Definition at line 219 of file sparse_shape.h.
|
inline |
"Sparse" constructor
This constructor uses tile norms given as a sparse tensor, represented as a sequence of {index,value_type} data. The tile norms are normalized to per-element norms by dividing each norm by the number of elements in the corresponding tile.
SparseNormSequence | the sequence of std::pair<index,value_type> objects, where index is a directly-addressable sequence indices. |
tile_norms | The Frobenius norm of tiles |
trange | The tiled range of the tensor |
Definition at line 240 of file sparse_shape.h.
|
inline |
Collective "dense" constructor.
This constructor uses tile norms given as a dense tensor. The tile norms data are summed across all processes (via an all reduce). Next, the norms are converted to per-element norms by dividing each norm by the number of elements in the corresponding tile.
world | The world where the shape will live |
tile_norms | The Frobenius norm of tiles |
trange | The tiled range of the tensor |
Definition at line 271 of file sparse_shape.h.
|
inline |
Collective "sparse" constructor.
This constructor uses tile norms given as a sparse tensor, represented as a sequence of {index,value_type} data. The tile norms are normalized to per-element norms by dividing each norm by the number of elements in the corresponding tile. Lastly, he norms are sum-reduced across all processors.
SparseNormSequence | the sequence of std::pair<index,value_type> objects, where index is a directly-addressable sequence of integers. |
world | The world where the shape will live |
tile_norms | The Frobenius norm of tiles |
trange | The tiled range of the tensor |
Definition at line 298 of file sparse_shape.h.
|
inline |
Copy constructor.
Shallow copy of other
.
other | The other shape object to be copied |
Definition at line 309 of file sparse_shape.h.
|
inline |
Add shapes.
Construct a new sum of shapes as:
other | The shape to be added to this shape |
Definition at line 701 of file sparse_shape.h.
|
inline |
Add and permute shapes.
Construct a new sum of shapes as:
other | The shape to be added to this shape |
perm | The permutation that is applied to the result |
this
+ other
Definition at line 732 of file sparse_shape.h.
|
inline |
Add and scale shapes.
Construct a new sum of shapes as:
Factor | The scaling factor type |
other | The shape to be added to this shape |
factor | The scaling factor |
Definition at line 767 of file sparse_shape.h.
|
inline |
Add, scale, and permute shapes.
Construct a new sum of shapes as:
Factor | The scaling factor type |
other | The shape to be added to this shape |
factor | The scaling factor |
perm | The permutation that is applied to the result |
Definition at line 804 of file sparse_shape.h.
|
inline |
|
inline |
|
inline |
Create a copy of a sub-block of the shape.
Index | The upper and lower bound array type |
lower_bound | The lower bound of the sub-block |
upper_bound | The upper bound of the sub-block |
Definition at line 530 of file sparse_shape.h.
|
inline |
Create a scaled sub-block of the shape.
Index | The upper and lower bound array type |
Factor | The scaling factor type |
lower_bound | The lower bound of the sub-block |
upper_bound | The upper bound of the sub-block |
Definition at line 565 of file sparse_shape.h.
|
inline |
Create a copy of a sub-block of the shape.
lower_bound | The lower bound of the sub-block |
upper_bound | The upper bound of the sub-block |
Definition at line 600 of file sparse_shape.h.
|
inline |
Create a copy of a sub-block of the shape.
Factor | The scaling factor type |
lower_bound | The lower bound of the sub-block |
upper_bound | The upper bound of the sub-block |
Definition at line 614 of file sparse_shape.h.
|
inline |
Data accessor.
Tensor
object that stores shape data Definition at line 414 of file sparse_shape.h.
|
inline |
Initialization check.
true
when this shape has been initialized. Definition at line 419 of file sparse_shape.h.
|
inline |
Factor | The scaling factor type |
Definition at line 1041 of file sparse_shape.h.
|
inline |
Factor | The scaling factor type |
Definition at line 1130 of file sparse_shape.h.
|
inlinestatic |
|
inline |
Check that a tile is zero.
Index | The type of the index |
Definition at line 340 of file sparse_shape.h.
|
inline |
Compute union of two shapes.
mask | The input shape, hard zeros are used to mask the output. |
Definition at line 425 of file sparse_shape.h.
|
inline |
|
inline |
|
inline |
Factor | The scaling factor type |
Definition at line 1006 of file sparse_shape.h.
|
inline |
Factor | The scaling factor type |
Definition at line 1022 of file sparse_shape.h.
|
inline |
Copy assignment operator.
Shallow copy of other
.
other | The other shape object to be copied |
Definition at line 319 of file sparse_shape.h.
|
inline |
Tile norm accessor.
Index | The index type |
index | The index of the tile norm to retrieve |
index
Definition at line 374 of file sparse_shape.h.
|
inline |
Create a permuted shape of this shape.
perm | The permutation to be applied |
Definition at line 624 of file sparse_shape.h.
|
inline |
Scale shape.
Construct a new scaled shape as:
Factor | The scaling factor type |
factor | The scaling factor |
Definition at line 640 of file sparse_shape.h.
|
inline |
Scale and permute shape.
Compute a new scaled shape is computed as:
Factor | The scaling factor type |
factor | The scaling factor |
perm | The permutation that will be applied to this tensor. |
Definition at line 672 of file sparse_shape.h.
|
inline |
Sparsity of the shape.
Definition at line 353 of file sparse_shape.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Threshold accessor.
Definition at line 361 of file sparse_shape.h.
|
inlinestatic |
Set threshold to thresh
.
thresh | The new threshold |
Definition at line 366 of file sparse_shape.h.
|
inline |
Transform the norm tensor with an operation.
Definition at line 389 of file sparse_shape.h.
|
inline |
Update sub-block of shape.
Update a sub-block shape information with another shape object.
Index | The bound index type |
lower_bound | The lower bound of the sub-block to be updated |
upper_bound | The upper bound of the sub-block to be updated |
other | The shape that will be used to update the sub-block |
other
. Definition at line 460 of file sparse_shape.h.
|
inline |
Validate shape range.
true
when range matches the range of this shape Definition at line 329 of file sparse_shape.h.