raisim::BlockRef
class · #include <raisim/math/Blocks.hpp>
Inherits: raisim::MatExpr< BlockRef< T, n, m > >
template <class T, size_t n, size_t m>
class BlockRefFixed-size n x m block view of a matrix, returned by Mat::segment(), Mat::head(), Mat::tail(), Mat::block() and the corner accessors. Reads and writes go to the referenced matrix; for a const matrix the accessors return by value. No bounds checking is done.
Public types
SelfType
typedef BlockRef<T, n, m> SelfTypeThis type.
MutableRef
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
BlockRef
BlockRef(T &array, size_t r_s, size_t c_s)Parameters
| Parameter | Description |
|---|---|
array (in) | referenced matrix |
r_s (in) | row of the block's top-left element |
c_s (in) | column of the block's top-left element |
Public member functions
operator()
double operator()(size_t i) constParameters
| Parameter | Description |
|---|---|
i (in) | column-major linear index into the block |
Returns element i of the block in column-major linear order.
MutableRef operator()(size_t i)Parameters
| Parameter | Description |
|---|---|
i (in) | column-major linear index into the block |
Returns element i of the block in column-major linear order.
double operator()(size_t i, size_t j) constParameters
| Parameter | Description |
|---|---|
i (in) | row index |
j (in) | column index |
Returns element (i, j) of the block.
MutableRef operator()(size_t i, size_t j)Parameters
| Parameter | Description |
|---|---|
i (in) | row index |
j (in) | column index |
Returns element (i, j) of the block.
operator[]
double operator[](size_t i) constParameters
| Parameter | Description |
|---|---|
i (in) | column-major linear index into the block |
Returns element i of the block in column-major linear order.
MutableRef operator[](size_t i)Parameters
| Parameter | Description |
|---|---|
i (in) | column-major linear index into the block |
Returns element i of the block in column-major linear order.
Static member functions
size static
static constexpr size_t size()Returns number of elements, n * m.
rows static
static constexpr size_t rows()Returns number of rows, n.
cols static
static constexpr size_t cols()Returns number of columns, m.
Public attributes
ref
T &refReferenced matrix.
rowStart
size_t rowStartRow of the block's top-left element in the referenced matrix.
colStart
size_t colStartColumn of the block's top-left element in the referenced matrix.