KJB
|
#include <l_index.h>
Classes | |
struct | End_type |
Public Member Functions | |
Index_range () | |
Index_range (size_t index) | |
Index_range (int index) | |
Index_range (const std::string &str) | |
Index_range (const char *str) | |
Index_range (const Index_range &src) | |
Index_range & | operator= (const Index_range &other) |
std::vector< size_t > | expand () const |
void | swap (Index_range &other) |
Index_range (const Int_vector &v) | |
template<class Int_type > | |
Index_range (typename std::vector< Int_type > v) | |
template<class Int_type > | |
Index_range (std::list< Int_type > v) | |
Index_range (size_t first, size_t end, size_t interval=1) | |
Index_range (size_t first, End_type end, size_t interval=1) | |
Index_range & | concat (Index_range &other) |
size_t | max () const |
~Index_range () | |
Index_range (bool all_elements) | |
size_t | operator[] (size_t i) const |
size_t | size () const |
bool | all () const |
Static Public Attributes | |
static const Index_range | ALL = Index_range(true) |
static const End_type | END |
Protected Attributes | |
std::vector< Range_element * > | ranges_ |
bool | all_ |
Object for specifying sets of matrix and vector indices. Ranges need not be contiguous or ordered, and values need not be unique. This object is indended to be passed to the subscript operator of Matrix and Vector, which will return sub-matrices and sub-vectors.
Contains a special constant, Index_range::all, which is an alias for an Index_range containing all indices of the Matrix/Vector, in ascending order.
Objects of this type are rarely created explicitly, but will be implicitly converted in calls to the subscript operator
v["2:5"] = Vector(1.0, 1.0, 2.0, 2.0);
|
inline |
empty range
|
inline |
Create a single-element range
|
inline |
Create a single-element range
|
inline |
Receives matlab-style strings like "1:3,4:2:10,15"
|
inline |
|
inline |
kjb::Index_range::Index_range | ( | const Int_vector & | v | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Convert the set of indices into a vector and return it.
Index_range can store large ranges symbolically, allowing it to represent an arbitrarilly large number of indices, while memory consumption remains constant. Calling this method for large ranges will require lots of memory, as all indices will be stored explicitly.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
|
protected |
|
static |
|
protected |