![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Index slice ( \( start, stride, size \)) used for strided slicing of vector and matrix expressions. More...
#include <Slice.hpp>
Inheritance diagram for CDPL::Math::Slice< S, D >:Public Types | |
| typedef S | SizeType |
| The integral size/index type. More... | |
| typedef D | DifferenceType |
| The signed difference type used for the stride. More... | |
Public Member Functions | |
| Slice () | |
| Constructs an empty slice ( \( 0, 0, 0 \)). More... | |
| Slice (SizeType start, DifferenceType stride, SizeType size) | |
| Constructs the slice (start, stride, size). More... | |
| SizeType | operator() (SizeType i) const |
| Maps the local position i to the global index \( start + i \cdot stride \). More... | |
| SizeType | getStart () const |
| Returns the starting global index. More... | |
| DifferenceType | getStride () const |
| Returns the signed step size between consecutive entries. More... | |
| SizeType | getSize () const |
| Returns the number of entries in the slice. More... | |
| bool | isEmpty () const |
| Tells whether the slice is empty. More... | |
| bool | operator== (const Slice &s) const |
| Equality comparison. More... | |
| bool | operator!= (const Slice &s) const |
| Inequality comparison. More... | |
| void | swap (Slice &s) |
Swaps the contents of *this and s. More... | |
Friends | |
| void | swap (Slice &s1, Slice &s2) |
| Free-function swap overload. More... | |
Index slice ( \( start, stride, size \)) used for strided slicing of vector and matrix expressions.
Local position i is mapped to the global index \( start + i \cdot stride \). Negative strides (reverse iteration) are supported as long as the resulting indices stay non-negative.
| S | The integral size/index type. |
| D | The signed difference type used for the stride. |
| typedef S CDPL::Math::Slice< S, D >::SizeType |
The integral size/index type.
| typedef D CDPL::Math::Slice< S, D >::DifferenceType |
The signed difference type used for the stride.
|
inline |
Constructs an empty slice ( \( 0, 0, 0 \)).
|
inline |
Constructs the slice (start, stride, size).
| start | The starting global index. |
| stride | The signed step size between consecutive entries. |
| size | The number of entries. |
| Base::RangeError | if the slice would produce a negative global index. |
|
inline |
Maps the local position i to the global index \( start + i \cdot stride \).
| i | The zero-based local position. |
| Base::IndexError | if i is not in the range \( [0, size) \). |
|
inline |
Returns the starting global index.
|
inline |
Returns the signed step size between consecutive entries.
|
inline |
Returns the number of entries in the slice.
|
inline |
Tells whether the slice is empty.
true if the slice contains no entries, and false otherwise.
|
inline |
Equality comparison.
| s | The other slice. |
true if both slices have the same start, stride and size, and false otherwise.
|
inline |
Inequality comparison.
| s | The other slice. |
true if the slices differ in start, stride or size, and false otherwise.
|
inline |
Swaps the contents of *this and s.
| s | The other slice. |
Free-function swap overload.
| s1 | The first slice. |
| s2 | The second slice. |