List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
casadi::Slice Class Reference

Class representing a Slice. More...

#include <slice.hpp>

Detailed Description

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

Definition at line 47 of file slice.hpp.

Inheritance diagram for casadi::Slice:
Inheritance graph
[legend]

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
 

Constructor & Destructor Documentation

◆ Slice() [1/6]

casadi::Slice::Slice ( )

◆ Slice() [2/6]

casadi::Slice::Slice ( casadi_int  i,
bool  ind1 = false 
)
explicit

◆ Slice() [3/6]

casadi::Slice::Slice ( casadi_int  start,
casadi_int  stop,
casadi_int  step = 1 
)

◆ Slice() [4/6]

casadi::Slice::Slice ( int  start,
int  stop,
int  step = 1 
)

◆ Slice() [5/6]

casadi::Slice::Slice ( int  start,
casadi_int  stop,
int  step = 1 
)

◆ Slice() [6/6]

casadi::Slice::Slice ( casadi_int  start,
int  stop,
int  step = 1 
)

Member Function Documentation

◆ all() [1/3]

std::vector<casadi_int> casadi::Slice::all ( ) const

◆ all() [2/3]

std::vector<casadi_int> casadi::Slice::all ( casadi_int  len,
bool  ind1 = false 
) const

◆ all() [3/3]

std::vector<casadi_int> casadi::Slice::all ( const Slice outer,
casadi_int  len 
) const

◆ apply()

Slice casadi::Slice::apply ( casadi_int  len,
bool  ind1 = false 
) const

◆ deserialize()

static Slice casadi::Slice::deserialize ( DeserializingStream s)
static

◆ disp()

void casadi::Slice::disp ( std::ostream &  stream,
bool  more = false 
) const

◆ get_str()

std::string casadi::Slice::get_str ( bool  more = false) const
inline

Definition at line 113 of file slice.hpp.

◆ info()

Dict casadi::Slice::info ( ) const
inline

Obtain information

Definition at line 120 of file slice.hpp.

◆ is_empty()

bool casadi::Slice::is_empty ( ) const

◆ is_scalar()

bool casadi::Slice::is_scalar ( casadi_int  len) const

◆ operator!=()

bool casadi::Slice::operator!= ( const Slice other) const
inline

Definition at line 95 of file slice.hpp.

◆ operator*()

Slice casadi::Slice::operator* ( casadi_int  i) const

◆ operator-()

Slice casadi::Slice::operator- ( casadi_int  i) const

◆ operator==()

bool casadi::Slice::operator== ( const Slice other) const
inline

Definition at line 90 of file slice.hpp.

◆ scalar()

casadi_int casadi::Slice::scalar ( casadi_int  len) const

◆ serialize()

void casadi::Slice::serialize ( SerializingStream s) const

◆ size()

size_t casadi::Slice::size ( ) const

◆ type_name()

std::string casadi::Slice::type_name ( ) const
inline

Definition at line 107 of file slice.hpp.

Member Data Documentation

◆ start

casadi_int casadi::Slice::start

Definition at line 51 of file slice.hpp.

◆ step

casadi_int casadi::Slice::step

Definition at line 54 of file slice.hpp.

◆ stop

casadi_int casadi::Slice::stop

Definition at line 53 of file slice.hpp.


The documentation for this class was generated from the following file: