1 #ifndef DASH__MATRIX__LOCAL_MATRIX_REF_H__ 2 #define DASH__MATRIX__LOCAL_MATRIX_REF_H__ 7 #include <dash/Pattern.h> 8 #include <dash/GlobRef.h> 9 #include <dash/HView.h> 11 #include <dash/iterator/GlobIter.h> 12 #include <dash/iterator/GlobViewIter.h> 14 #include <dash/Matrix.h> 64 typedef std::array<typename PatternT::size_type, NumDimensions>
66 typedef std::array<typename PatternT::index_type, NumDimensions>
70 template <dim_t NumViewDim>
77 typename PatternT::index_type,
101 typedef T value_type;
102 typedef PatternT pattern_type;
103 typedef typename PatternT::index_type index_type;
105 typedef typename PatternT::size_type size_type;
106 typedef typename PatternT::index_type difference_type;
111 typedef std::reverse_iterator<iterator> reverse_iterator;
112 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
120 typedef T * local_pointer;
121 typedef const T * const_local_pointer;
125 template <dim_t NumViewDim>
130 typedef std::integral_constant<dim_t, CUR>
139 MatrixRefView_t && refview)
140 : _refview(std::move(refview))
142 DASH_LOG_TRACE_VAR(
"LocalMatrixRef<T,D,C>()", NumDimensions);
143 DASH_LOG_TRACE_VAR(
"LocalMatrixRef<T,D,C>()", CUR);
147 const MatrixRefView_t & refview)
150 DASH_LOG_TRACE_VAR(
"LocalMatrixRef<T,D,C>()", NumDimensions);
151 DASH_LOG_TRACE_VAR(
"LocalMatrixRef<T,D,C>()", CUR);
160 DASH_LOG_TRACE_VAR(
"LocalMatrixRef<T,D,C>()", NumDimensions);
161 DASH_LOG_TRACE_VAR(
"LocalMatrixRef<T,D,C>()", CUR);
181 const std::array<index_type, NumDimensions> & block_lcoords
188 index_type block_lindex
191 inline operator LocalMatrixRef<T, NumDimensions, CUR-1, PatternT, LocalMemT> && () &&;
202 inline const T &
local_at(size_type pos)
const;
204 constexpr
Team & team()
const noexcept;
206 constexpr size_type
size()
const noexcept;
207 constexpr size_type local_size()
const noexcept;
208 constexpr size_type local_capacity()
const noexcept;
210 constexpr Extents_t extents()
const noexcept;
211 inline index_type offset(
dim_t dim)
const noexcept;
212 constexpr Offsets_t offsets()
const noexcept;
213 constexpr
bool empty()
const noexcept;
223 constexpr
const PatternT &
pattern()
const;
225 inline iterator
begin() noexcept;
226 constexpr const_iterator
begin()
const noexcept;
227 inline iterator
end() noexcept;
228 constexpr const_iterator
end()
const noexcept;
230 inline local_pointer lbegin() noexcept;
231 constexpr const_local_pointer lbegin()
const noexcept;
232 inline local_pointer lend() noexcept;
233 constexpr const_local_pointer lend()
const noexcept;
243 template<
typename ... Args>
257 template<
typename... Args>
266 template<
dim_t __NumViewDim = CUR-1>
267 typename std::enable_if<(__NumViewDim > 0),
269 operator[](size_type n);
271 template<
dim_t __NumViewDim = CUR-1>
272 typename std::enable_if<(__NumViewDim == 0), T&>::type
279 template<
dim_t __NumViewDim = CUR-1>
280 typename std::enable_if<(__NumViewDim > 0),
282 constexpr
operator[](size_type n)
const;
284 template<
dim_t __NumViewDim = CUR-1>
285 typename std::enable_if<(__NumViewDim == 0), const T&>::type
288 LocalMatrixRef<T, NumDimensions, NumDimensions-1, PatternT, LocalMemT>
290 constexpr
LocalMatrixRef<
const T, NumDimensions, NumDimensions-1, PatternT, LocalMemT>
291 col(size_type n)
const;
293 LocalMatrixRef<T, NumDimensions, NumDimensions-1, PatternT, LocalMemT>
295 constexpr
LocalMatrixRef<
const T, NumDimensions, NumDimensions-1, PatternT, LocalMemT>
296 row(size_type n)
const;
298 template<dim_t NumSubDimensions>
299 LocalMatrixRef<T, NumDimensions, NumDimensions-1, PatternT, LocalMemT>
302 template<dim_t NumSubDimensions>
303 LocalMatrixRef<
const T, NumDimensions, NumDimensions-1, PatternT, LocalMemT>
304 sub(size_type n)
const;
306 template<dim_t SubDimension>
311 template<dim_t SubDimension>
314 size_type range)
const;
337 size_type range)
const;
360 size_type extent)
const;
364 MatrixRefView_t _refview;
369 #include <dash/matrix/internal/LocalMatrixRef-inl.h> constexpr dim_t rank(const DimensionalType &d)
T & operator()(Args... args)
Fortran-style subscript operator, alias for at().
size_t size()
Return the number of units in the global team.
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
This class is a simple memory pool which holds allocates elements of size ValueType.
Global iterator on an index set specified by a view modifier.
Specifies view parameters for implementing submat, rows and cols.
std::enable_if<(__NumViewDim > 0), LocalMatrixRef< T, NumDimensions, __NumViewDim, PatternT, LocalMemT > >::type operator[](size_type n)
Subscript assignment operator, access element at given offset in global element range.
constexpr auto begin(RangeType &&range) -> decltype(std::forward< RangeType >(range).begin())
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
LocalMatrixRef< T, NumDimensions, CUR, PatternT, LocalMemT > block(const std::array< index_type, NumDimensions > &block_lcoords)
View at local block at given local block coordinates.
LocalMatrixRef< T, NumDimensions, NumDimensions, PatternT, LocalMemT > rows(size_type offset, size_type range)
Create a view representing the matrix slice within a row range.
Stores information needed by subscripting and subdim selection.
A Team instance specifies a subset of all available units.
constexpr dim_t ndim(const DimensionalType &d)
constexpr const PatternT & pattern() const
The pattern used to distribute matrix elements to units in its associated team.
T & at(Args... args)
Fortran-style subscript operator.
T & local_at(size_type pos)
Returns a reference to the element at local index pos.
constexpr DimensionalType::extent_type extent(const DimensionalType &d)
constexpr ViewSubMod< ViewOrigin< NViewDim >, SubDim > sub(OffsetFirstT begin, OffsetFinalT end)
Sub-section, view dimensions maintain domain dimensions.
LocalMatrixRef< T, NumDimensions, NumDimensions, PatternT, LocalMemT > cols(size_type offset, size_type extent)
Create a view representing the matrix slice within a column range.