Add mju_gather and mju_scatter, private engine functions.
PiperOrigin-RevId: 750245294 Change-Id: I3a14ccdd55a324d3fe206e388fb2a513772f5f5e
This commit is contained in:
committed by
Copybara-Service
parent
99490163df
commit
c2ac0d724e
@@ -1130,14 +1130,12 @@ void mj_addM(const mjModel* m, mjData* d, mjtNum* dst,
|
||||
int nC = m->nC;
|
||||
mj_markStack(d);
|
||||
|
||||
// create reduced sparse inertia matrix C
|
||||
// gather C <- qM (legacy to CSR)
|
||||
mjtNum* C = mjSTACKALLOC(d, nC, mjtNum);
|
||||
for (int i=0; i < nC; i++) {
|
||||
C[i] = d->qM[d->mapM2C[i]];
|
||||
}
|
||||
mju_gather(C, d->qM, d->mapM2C, nC);
|
||||
|
||||
mj_addMSparse(m, d, dst, rownnz, rowadr, colind, C,
|
||||
d->C_rownnz, d->C_rowadr, d->C_colind);
|
||||
// add to dst
|
||||
mj_addMSparse(m, d, dst, rownnz, rowadr, colind, C, d->C_rownnz, d->C_rowadr, d->C_colind);
|
||||
mj_freeStack(d);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user