20 #ifndef TILEDARRAY_TENSOR_IMPL_H__INCLUDED 21 #define TILEDARRAY_TENSOR_IMPL_H__INCLUDED 38 template <
typename Policy>
53 std::shared_ptr<pmap_interface> pmap_;
67 const std::shared_ptr<pmap_interface>&
pmap) :
72 TA_ASSERT(pmap_->size() == trange_.tiles_range().volume());
73 TA_ASSERT(pmap_->rank() ==
typename pmap_interface::size_type(world_.rank()));
74 TA_ASSERT(pmap_->procs() ==
typename pmap_interface::size_type(world_.size()));
75 TA_ASSERT(shape_.validate(trange_.tiles_range()));
85 const std::shared_ptr<pmap_interface>&
pmap()
const {
return pmap_; }
115 template <
typename Index>
116 ProcessID
owner(
const Index& i)
const {
117 TA_ASSERT(trange_.tiles_range().includes(i));
118 return pmap_->owner(trange_.tiles_range().ordinal(i));
127 template <
typename Index>
129 TA_ASSERT(trange_.tiles_range().includes(i));
130 return pmap_->is_local(trange_.tiles_range().ordinal(i));
140 template <
typename Index>
142 TA_ASSERT(trange_.tiles_range().includes(i));
143 return shape_.is_zero(trange_.tiles_range().ordinal(i));
150 bool is_dense()
const {
return shape_.is_dense(); }
169 World&
world()
const {
return world_; }
174 #ifndef TILEDARRAY_HEADER_ONLY 177 class TensorImpl<DensePolicy>;
179 class TensorImpl<SparsePolicy>;
181 #endif // TILEDARRAY_HEADER_ONLY 186 #endif // TILEDARRAY_TENSOR_IMPL_H__INCLUDED const shape_type & shape() const
Tensor shape accessor.
const trange_type & trange() const
Tiled range accessor.
Policy::range_type range_type
Element/tile range type.
Policy::pmap_interface pmap_interface
Process map interface type.
bool is_dense() const
Query the density of the tensor.
size_type local_size() const
Local element count.
Tensor implementation and base for other tensor implementation objects.
Policy policy_type
Policy type.
virtual ~TensorImpl()
Virtual destructor.
Policy::trange_type trange_type
Tiled range type.
DEPRECATED World & get_world() const
TensorImpl(World &world, const trange_type &trange, const shape_type &shape, const std::shared_ptr< pmap_interface > &pmap)
Constructor.
ProcessID owner(const Index &i) const
Query a tile owner.
bool is_local(const Index &i) const
Query for a locally owned tile.
bool is_zero(const Index &i) const
Query for a zero tile.
Policy::size_type size_type
Size type.
size_type size() const
Tensor tile volume accessor.
TensorImpl< Policy > TensorImpl_
World & world() const
World accessor.
const range_type & tiles_range() const
Tiles range accessor.
const std::shared_ptr< pmap_interface > & pmap() const
Tensor process map accessor.
Policy::shape_type shape_type
Tensor shape type.