Drake
Subvector< T > Class Template Reference

Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase. More...

#include <systems/framework/subvector.h>

Inheritance diagram for Subvector< T >:
[legend]
Collaboration diagram for Subvector< T >:
[legend]

Public Member Functions

 Subvector (VectorBase< T > *vector, int first_element, int num_elements)
 Constructs a subvector of vector that consists of num_elements starting at first_element. More...
 
 Subvector (VectorBase< 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...
 
T & GetAtIndex (int index) override
 Returns the element at the given index in the vector. More...
 
Does not allow copy, move, or assignment
 Subvector (const Subvector &)=delete
 
Subvectoroperator= (const Subvector &)=delete
 
 Subvector (Subvector &&)=delete
 
Subvectoroperator= (Subvector &&)=delete
 
- Public Member Functions inherited from VectorBase< T >
virtual ~VectorBase ()
 
T & operator[] (std::size_t idx)
 
const T & operator[] (std::size_t idx) const
 
void SetAtIndex (int index, const T &value)
 Replaces the state at the given index with the value. More...
 
virtual void SetFrom (const VectorBase< T > &value)
 Replaces the entire vector with the contents of value. More...
 
virtual void SetFromVector (const Eigen::Ref< const VectorX< T >> &value)
 Replaces the entire vector with the contents of value. More...
 
virtual void SetZero ()
 
virtual VectorX< T > CopyToVector () const
 Copies the entire state to a vector with no semantics. More...
 
virtual void ScaleAndAddToVector (const T &scale, Eigen::Ref< VectorX< T >> vec) const
 Adds a scaled version of this vector to Eigen vector vec, which must be the same size. More...
 
VectorBasePlusEqScaled (const T &scale, const VectorBase< T > &rhs)
 Add in scaled vector rhs to this vector. More...
 
VectorBasePlusEqScaled (const std::initializer_list< std::pair< T, const VectorBase< T > & >> &rhs_scale)
 Add in multiple scaled vectors to this vector. More...
 
VectorBaseoperator+= (const VectorBase< T > &rhs)
 Add in vector rhs to this vector. More...
 
VectorBaseoperator-= (const VectorBase< T > &rhs)
 Subtract in vector rhs to this vector. More...
 
virtual T NormInf () const
 Computes the infinity norm for this vector. More...
 
virtual void CalcInequalityConstraint (VectorX< T > *value) const
 Populates a vector value suitable for a SystemConstraint inequality constraint. More...
 
 VectorBase (const VectorBase &)=delete
 
VectorBaseoperator= (const VectorBase &)=delete
 
 VectorBase (VectorBase &&)=delete
 
VectorBaseoperator= (VectorBase &&)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from VectorBase< T >
 VectorBase ()
 
virtual void DoPlusEqScaled (const std::initializer_list< std::pair< T, const VectorBase< T > & >> &rhs_scale)
 Adds in multiple scaled vectors to this vector. More...
 

Detailed Description

template<typename T>
class drake::systems::Subvector< T >

Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase.

Template Parameters
TA mathematical type compatible with Eigen's Scalar.

Constructor & Destructor Documentation

Subvector ( const Subvector< T > &  )
delete
Subvector ( Subvector< T > &&  )
delete
Subvector ( VectorBase< T > *  vector,
int  first_element,
int  num_elements 
)
inline

Constructs a subvector of vector that consists of num_elements starting at first_element.

Parameters
vectorThe vector to slice. Must not be nullptr. Must remain valid for the lifetime of this object.
Subvector ( VectorBase< T > *  vector)
inlineexplicit

Constructs an empty subvector.

Parameters
vectorThe vector to slice. Must not be nullptr. Must remain valid for the lifetime of this object.

Member Function Documentation

const T& GetAtIndex ( int  index) const
inlineoverridevirtual

Returns the element at the given index in the vector.

Throws std::runtime_error if the index is >= size().

Implementations should ensure this operation is O(1) and allocates no memory.

Implements VectorBase< T >.

Here is the call graph for this function:

T& GetAtIndex ( int  index)
inlineoverridevirtual

Returns the element at the given index in the vector.

Throws std::runtime_error if the index is >= size().

Implementations should ensure this operation is O(1) and allocates no memory.

Implements VectorBase< T >.

Here is the call graph for this function:

Subvector& operator= ( Subvector< T > &&  )
delete
Subvector& operator= ( const Subvector< T > &  )
delete
int size ( ) const
inlineoverridevirtual

Returns the number of elements in the vector.

Implementations should ensure this operation is O(1) and allocates no memory.

Implements VectorBase< T >.

Here is the caller graph for this function:


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