Skip to content

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 ​

cpp
SparseJacobian1D() = default

~SparseJacobian1D ​

cpp
~SparseJacobian1D() = default

Public member functions ​

resize ​

cpp
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

ParameterDescription
cols (in)number of stored entries

operator[] ​

cpp
double operator[](size_t i) const

Parameters

ParameterDescription
i (in)entry index

Returns stored value i.

cpp
double &operator[](size_t i)

Parameters

ParameterDescription
i (in)entry index

Returns reference to stored value i.

operator*= ​

cpp
void operator*=(double val)

Multiplies all stored values by val.

Parameters

ParameterDescription
val (in)scale factor

ptr ​

cpp
double *ptr()

Returns pointer to the first stored value.

cpp
const double *ptr() const

Returns pointer to the first stored value.

data ​

cpp
double *data()

Returns pointer to the first stored value (Eigen-compatible name).

cpp
const double *data() const

Returns pointer to the first stored value (Eigen-compatible name).

e ​

cpp
Eigen::Map<Eigen::Matrix<double, -1, -1>> e()

Returns Eigen map of the 1 x size value row.

cpp
const Eigen::Map<const Eigen::Matrix<double, -1, -1>> e() const

Returns read-only Eigen map of the 1 x size value row.

operator= ​

cpp
SparseJacobian1D &operator=(const SparseJacobian1D &rhs)

Deep copy of the size, capacity, values and indices.

Parameters

ParameterDescription
rhs (in)Jacobian to copy

Returns *this

Public attributes ​

size ​

cpp
size_t size

Number of stored (non-zero) entries.

capacity ​

cpp
size_t capacity

Number of allocated entries.

v ​

cpp
MatDyn v

Value storage, 1 x capacity; only the first size entries are meaningful.

idx ​

cpp
std::vector<size_t> idx

idx[i] is the full-Jacobian column (generalized-velocity index) of stored entry i.

RaiSim — physics for robotics and AI.