![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Index slice ( \( start, stride, size \)) used for strided slicing of vector and matrix expressions. More...
Inheritance diagram for CDPL.Math.Slice:Public Member Functions | |
| None | __init__ () |
| Constructs an empty slice ( \( 0, 0, 0 \)). | |
| None | __init__ (Slice s) |
Initializes a copy of the Slice instance s. More... | |
| None | __init__ (int start, int stride, int size) |
| Constructs the slice (start, stride, size). More... | |
| int | getStart () |
| Returns the starting global index. More... | |
| int | getStride () |
| Returns the signed step size between consecutive entries. More... | |
| int | getSize () |
| Returns the number of entries in the slice. More... | |
| bool | isEmpty () |
| Tells whether the slice is empty. More... | |
| int | getIndex (int i) |
| Slice | assign (Slice s) |
Replaces the current state of self with a copy of the state of the Slice instance s. More... | |
| None | swap (Slice s) |
Swaps the contents of self and s. More... | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
| bool | __eq__ (Slice s) |
| Equality comparison. More... | |
| bool | __ne__ (Slice s) |
| Inequality comparison. More... | |
| int | __call__ (int i) |
| Maps the local position i to the global index \( start + i \cdot stride \). More... | |
| int | __getitem__ (int i) |
Properties | |
| objectID = property(getObjectID) | |
| start = property(getStart) | |
| stride = property(getStride) | |
| size = property(getSize) | |
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.
| None CDPL.Math.Slice.__init__ | ( | Slice | s | ) |
Initializes a copy of the Slice instance s.
| s | The Slice instance to copy. |
| None CDPL.Math.Slice.__init__ | ( | int | start, |
| int | stride, | ||
| int | size | ||
| ) |
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. |
| int CDPL.Math.Slice.getStart | ( | ) |
Returns the starting global index.
| int CDPL.Math.Slice.getStride | ( | ) |
Returns the signed step size between consecutive entries.
| int CDPL.Math.Slice.getSize | ( | ) |
Returns the number of entries in the slice.
| bool CDPL.Math.Slice.isEmpty | ( | ) |
Tells whether the slice is empty.
True if the slice contains no entries, and False otherwise. | int CDPL.Math.Slice.getIndex | ( | int | i | ) |
| i |
Replaces the current state of self with a copy of the state of the Slice instance s.
| s | The Slice instance to copy. |
| None CDPL.Math.Slice.swap | ( | Slice | s | ) |
Swaps the contents of self and s.
| s | The other slice. |
| int CDPL.Math.Slice.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python Slice instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two Slice instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().
| bool CDPL.Math.Slice.__eq__ | ( | Slice | s | ) |
Equality comparison.
| s | The other slice. |
True if both slices have the same start, stride and size, and False otherwise. | bool CDPL.Math.Slice.__ne__ | ( | Slice | s | ) |
Inequality comparison.
| s | The other slice. |
True if the slices differ in start, stride or size, and False otherwise. | int CDPL.Math.Slice.__call__ | ( | int | i | ) |
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) \). |
| int CDPL.Math.Slice.__getitem__ | ( | int | i | ) |
| i |