Drake
|
StateSubvector is a concrete class template that implements StateVector by providing a sliced view of a StateVector. More...
#include <drake/systems/framework/state_subvector.h>
Public Member Functions | |
StateSubvector (StateVector< T > *vector, int first_element, int num_elements) | |
Constructs a subvector of vector that consists of num_elements starting at first_element. More... | |
StateSubvector (StateVector< T > *vector) | |
Constructs an empty subvector. More... | |
int | size () const override |
Returns the number of elements in the vector. More... | |
const T | GetAtIndex (int index) const override |
Returns the element at the given index in the vector. More... | |
void | SetAtIndex (int index, const T &value) override |
Replaces the state at the given index with the value. More... | |
void | SetFromVector (const Eigen::Ref< const VectorX< T >> &value) override |
Replaces the entire state with the contents of value. More... | |
VectorX< T > | CopyToVector () const override |
Copies the entire state to a vector with no semantics. More... | |
Public Member Functions inherited from StateVector< T > | |
virtual | ~StateVector () |
virtual void | ScaleAndAddToVector (const T &scale, Eigen::Ref< VectorX< T >> vec) const |
Adds a scaled version of this state vector to Eigen vector vec , which must be the same size. More... | |
virtual StateVector & | PlusEqScaled (const T &scale, const StateVector< T > &rhs) |
Add in scaled state vector rhs to this state vector. More... | |
StateVector & | operator+= (const StateVector< T > &rhs) |
Add in state vector rhs to this state vector. More... | |
StateVector & | operator-= (const StateVector< T > &rhs) |
Subtract in state vector rhs to this state vector. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from StateVector< T > | |
StateVector () | |
StateSubvector is a concrete class template that implements StateVector by providing a sliced view of a StateVector.
T | A mathematical type compatible with Eigen's Scalar. |
|
inline |
Constructs a subvector of vector that consists of num_elements starting at first_element.
vector | The vector to slice. Must not be nullptr. Must remain valid for the lifetime of this object. |
|
inlineexplicit |
Constructs an empty subvector.
vector | The vector to slice. Must not be nullptr. Must remain valid for the lifetime of this object. |
|
inlineoverridevirtual |
Copies the entire state to a vector with no semantics.
Implementations should ensure this operation is O(N) in the size of the value and allocates only the O(N) memory that it returns.
Implements StateVector< T >.
|
inlineoverridevirtual |
Returns the element at the given index in the vector.
Throws std::out_of_range if the index is >= size().
Implementations should ensure this operation is O(1) and allocates no memory.
Implements StateVector< T >.
|
inlineoverridevirtual |
Replaces the state at the given index with the value.
Throws std::out_of_range if the index is >= size().
Implementations should ensure this operation is O(1) and allocates no memory.
Implements StateVector< T >.
|
inlineoverridevirtual |
Replaces the entire state with the contents of value.
Throws std::out_of_range if value is not a column vector with size() rows.
Implementations should ensure this operation is O(N) in the size of the value and allocates no memory.
Implements StateVector< T >.
|
inlineoverridevirtual |
Returns the number of elements in the vector.
Implementations should ensure this operation is O(1) and allocates no memory.
Implements StateVector< T >.