raisim::SparseJacobian1D
class · #include <raisim/math.hpp>
Single-row counterpart of SparseJacobian: v holds the non-zero entries as a 1 x size row and entry i is column idx[i] of the full 1 x dof Jacobian.
Constructors & destructor
SparseJacobian1D
SparseJacobian1D() = default~SparseJacobian1D
~SparseJacobian1D() = defaultPublic member functions
resize
void resize(size_t cols)Sets the number of stored entries, reallocating only when it exceeds the capacity, and zeroes the first cols values.
Parameters
| Parameter | Description |
|---|---|
cols (in) | number of stored entries |
operator[]
double operator[](size_t i) constParameters
| Parameter | Description |
|---|---|
i (in) | entry index |
Returns stored value i.
double &operator[](size_t i)Parameters
| Parameter | Description |
|---|---|
i (in) | entry index |
Returns reference to stored value i.
operator*=
void operator*=(double val)Multiplies all stored values by val.
Parameters
| Parameter | Description |
|---|---|
val (in) | scale factor |
ptr
double *ptr()Returns pointer to the first stored value.
const double *ptr() constReturns pointer to the first stored value.
data
double *data()Returns pointer to the first stored value (Eigen-compatible name).
const double *data() constReturns pointer to the first stored value (Eigen-compatible name).
e
Eigen::Map<Eigen::Matrix<double, -1, -1>> e()Returns Eigen map of the 1 x size value row.
const Eigen::Map<const Eigen::Matrix<double, -1, -1>> e() constReturns read-only Eigen map of the 1 x size value row.
operator=
SparseJacobian1D &operator=(const SparseJacobian1D &rhs)Deep copy of the size, capacity, values and indices.
Parameters
| Parameter | Description |
|---|---|
rhs (in) | Jacobian to copy |
Returns *this
Public attributes
size
size_t sizeNumber of stored (non-zero) entries.
capacity
size_t capacityNumber of allocated entries.
v
MatDyn vValue storage, 1 x capacity; only the first size entries are meaningful.
idx
std::vector<size_t> idxidx[i] is the full-Jacobian column (generalized-velocity index) of stored entry i.