Skip to content

raisim::RowRef ​

class · #include <raisim/math/Blocks.hpp>

Inherits: raisim::MatExpr< RowRef< T, m > >

cpp
template <class T, size_t m>
class RowRef

View of one row (m elements) of a matrix, returned by Mat::row(). Reads and writes go to the referenced matrix; for a const matrix the accessors return by value.

Public types ​

SelfType ​

cpp
typedef RowRef<T, m> SelfType

This type.

MutableRef ​

cpp
using MutableRef = std::conditional_t<std::is_const<T>::value, double, double &>

double& for a mutable referenced matrix, double for a const one.

Constructors & destructor ​

RowRef ​

cpp
RowRef(T &array, size_t r)

Parameters

ParameterDescription
array (in)referenced matrix
r (in)row index

Public member functions ​

operator() ​

cpp
double operator()(size_t i) const

Parameters

ParameterDescription
i (in)element index

Returns element i of the row.

cpp
MutableRef operator()(size_t i)

Parameters

ParameterDescription
i (in)element index

Returns element i of the row.

cpp
double operator()(size_t i, size_t j) const

Parameters

ParameterDescription
i (in)ignored
j (in)column index

Returns element j of the row; i is ignored.

cpp
MutableRef operator()(size_t i, size_t j)

Parameters

ParameterDescription
i (in)ignored
j (in)column index

Returns element j of the row; i is ignored.

operator[] ​

cpp
double operator[](size_t i) const

Parameters

ParameterDescription
i (in)element index

Returns element i of the row.

cpp
MutableRef operator[](size_t i)

Parameters

ParameterDescription
i (in)element index

Returns element i of the row.

operator= ​

cpp
template <class T2>
RowRef<T, m> &operator=(const MatExpr<T2> &expr)

Writes the m elements of expr (in linear order) into the row.

Parameters

ParameterDescription
expr (in)source expression with m elements

Returns *this

cpp
template <size_t exprRows>
RowRef<T, m> &operator=(const Mat<exprRows, 1> &expr)

Writes a column vector of size m into the row.

Parameters

ParameterDescription
expr (in)source vector

Returns *this

Static member functions ​

size static ​

cpp
static constexpr size_t size()

Returns number of elements, m.

rows static ​

cpp
static constexpr size_t rows()

Returns 1.

cols static ​

cpp
static constexpr size_t cols()

Returns number of columns, m.

Public attributes ​

ref ​

cpp
T &ref

Referenced matrix.

row ​

cpp
size_t row

Row index in the referenced matrix.

RaiSim — physics for robotics and AI.