TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
Multi-dimensional indexing

Detailed Description

Map multi-dimensional indices to a linear/flat index and vice versa and calculate the resulting memory layout when taking slices of already existing arrays/views.

Classes

class  nda::idx_map< Rank, StaticExtents, StrideOrder, LayoutProp >
 Layout that specifies how to map multi-dimensional indices to a linear/flat index. More...
 
class  nda::rect_str< Rank, StaticExtents, StrideOrder, LayoutProp >
 Layout that specifies how to map multi-dimensional indices including possible string indices to a linear/flat index. More...
 

Functions

template<int R, uint64_t SE, uint64_t SO, layout_prop_e LP, typename... Args>
__inline__ decltype(auto) nda::slice_static::slice_idx_map (idx_map< R, SE, SO, LP > const &idxm, Args const &...args)
 Determine the resulting nda::idx_map when taking a slice of a given nda::idx_map.
 

Variables

template<int Rank>
constexpr uint64_t nda::C_stride_order = nda::encode(nda::permutations::identity<Rank>())
 C/Row-major stride order.
 
template<int Rank>
constexpr uint64_t nda::Fortran_stride_order = nda::encode(nda::permutations::reverse_identity<Rank>())
 Fortran/Column-major stride order.
 

Function Documentation

◆ slice_idx_map()

template<int R, uint64_t SE, uint64_t SO, layout_prop_e LP, typename... Args>
__inline__ decltype(auto) nda::slice_static::slice_idx_map ( idx_map< R, SE, SO, LP > const & idxm,
Args const &... args )

#include <nda/layout/slice_static.hpp>

Determine the resulting nda::idx_map when taking a slice of a given nda::idx_map.

Let n_args be the number of given long, nda::range, nda::range::all_t or nda::ellipsis arguments.

The rank R' of the resulting slice is determined by the rank R of the original nda::idx_map and the number n_long of long arguments, i.e. R' = R - n_long.

The number of allowed nda::ellipsis objects is restricted to at most one. If an nda::ellipsis object is present and n_args <= R, the ellipsis is expanded in terms of nda::range::all_t objects to cover the remaining R - n_args + 1 dimensions. Otherwise, the ellipsis is ignored.

After ellipsis expansion, the only arguments contributing to the slice are nda::range and nda::range::all_t objects. Together with the original nda::idx_map, they determine the resulting nda::idx_map.

Template Parameters
RRank of the original nda::idx_map.
SEStatic extents of the original nda::idx_map.
SOStride order of the original nda::idx_map.
LPLayout properties of the original nda::idx_map.
ArgsGiven argument types.
Parameters
idxmOriginal nda::idx_map.
argsArguments consisting of long, nda::range, nda::range::all_t or nda::ellipsis objects.
Returns
Resulting nda::idx_map of the slice.

Definition at line 325 of file slice_static.hpp.

Variable Documentation

◆ C_stride_order

template<int Rank>
uint64_t nda::C_stride_order = nda::encode(nda::permutations::identity<Rank>())
constexpr

#include <nda/layout/idx_map.hpp>

C/Row-major stride order.

The last dimension varies the fastest, the first dimension the slowest.

Template Parameters
RankNumber of dimensions.

Definition at line 65 of file idx_map.hpp.

◆ Fortran_stride_order

template<int Rank>
uint64_t nda::Fortran_stride_order = nda::encode(nda::permutations::reverse_identity<Rank>())
constexpr

#include <nda/layout/idx_map.hpp>

Fortran/Column-major stride order.

The first dimension varies the fastest, the last dimension the slowest.

Template Parameters
RankNumber of dimensions.

Definition at line 57 of file idx_map.hpp.