Class representing a Slice. More...
#include <slice.hpp>
Note that Python or Octave do not need to use this class. They can just use slicing utility from the host language ( M[0:6] in Python, M(1:7) )
Extra doc: https://github.com/casadi/casadi/wiki/L_13
Public Member Functions | |
Slice () | |
Default constructor - all elements. More... | |
Slice (casadi_int i, bool ind1=false) | |
A single element (explicit to avoid ambiguity with IM overload. More... | |
Slice (casadi_int start, casadi_int stop, casadi_int step=1) | |
A slice. More... | |
Slice (int start, int stop, int step=1) | |
Slice (int start, casadi_int stop, int step=1) | |
Slice (casadi_int start, int stop, int step=1) | |
std::vector< casadi_int > | all () const |
Get a vector of indices. More... | |
std::vector< casadi_int > | all (casadi_int len, bool ind1=false) const |
Get a vector of indices. More... | |
std::vector< casadi_int > | all (const Slice &outer, casadi_int len) const |
Get a vector of indices (nested slice) More... | |
size_t | size () const |
Get number of elements. More... | |
bool | is_empty () const |
Check if slice is empty. More... | |
bool | is_scalar (casadi_int len) const |
Is the slice a scalar. More... | |
casadi_int | scalar (casadi_int len) const |
Get scalar (if is_scalar) More... | |
bool | operator== (const Slice &other) const |
Check equality. More... | |
bool | operator!= (const Slice &other) const |
Check inequality. More... | |
Slice | apply (casadi_int len, bool ind1=false) const |
Apply concrete length. More... | |
Slice | operator- (casadi_int i) const |
Substract. More... | |
Slice | operator* (casadi_int i) const |
std::string | type_name () const |
Get name of the class. More... | |
void | disp (std::ostream &stream, bool more=false) const |
Print a description of the object. More... | |
std::string | get_str (bool more=false) const |
Get string representation. More... | |
Dict | info () const |
void | serialize (SerializingStream &s) const |
Serialize an object. More... | |
Static Public Member Functions | |
static Slice | deserialize (DeserializingStream &s) |
Deserialize without type information. More... | |
Public Attributes | |
casadi_int | start |
start value: negative values will get added to length More... | |
casadi_int | stop |
stop value: use std::numeric_limits<casadi_int>::max() to indicate unboundedness More... | |
casadi_int | step |
casadi::Slice::Slice | ( | ) |
|
explicit |
casadi::Slice::Slice | ( | casadi_int | start, |
casadi_int | stop, | ||
casadi_int | step = 1 |
||
) |
casadi::Slice::Slice | ( | int | start, |
int | stop, | ||
int | step = 1 |
||
) |
casadi::Slice::Slice | ( | int | start, |
casadi_int | stop, | ||
int | step = 1 |
||
) |
casadi::Slice::Slice | ( | casadi_int | start, |
int | stop, | ||
int | step = 1 |
||
) |
std::vector<casadi_int> casadi::Slice::all | ( | ) | const |
std::vector<casadi_int> casadi::Slice::all | ( | casadi_int | len, |
bool | ind1 = false |
||
) | const |
std::vector<casadi_int> casadi::Slice::all | ( | const Slice & | outer, |
casadi_int | len | ||
) | const |
Slice casadi::Slice::apply | ( | casadi_int | len, |
bool | ind1 = false |
||
) | const |
|
static |
Extra doc: https://github.com/casadi/casadi/wiki/L_15
void casadi::Slice::disp | ( | std::ostream & | stream, |
bool | more = false |
||
) | const |
|
inline |
|
inline |
bool casadi::Slice::is_empty | ( | ) | const |
bool casadi::Slice::is_scalar | ( | casadi_int | len | ) | const |
|
inline |
Slice casadi::Slice::operator* | ( | casadi_int | i | ) | const |
Slice casadi::Slice::operator- | ( | casadi_int | i | ) | const |
|
inline |
casadi_int casadi::Slice::scalar | ( | casadi_int | len | ) | const |
void casadi::Slice::serialize | ( | SerializingStream & | s | ) | const |
Extra doc: https://github.com/casadi/casadi/wiki/L_14
size_t casadi::Slice::size | ( | ) | const |