Rename nnzJ to nJ in mjData.

This naming is more consistent.

PiperOrigin-RevId: 691858223
Change-Id: Ife3db822afa0b51b30d0792548b35b3742da388a
This commit is contained in:
Yuval Tassa
2024-10-31 10:42:29 -07:00
committed by Copybara-Service
parent 554641060b
commit c9f78ad8a8
10 changed files with 33 additions and 34 deletions
+7 -8
View File
@@ -1943,7 +1943,7 @@ static int mj_nc(const mjModel* m, mjData* d, int* nnz) {
// driver: call all functions above
void mj_makeConstraint(const mjModel* m, mjData* d) {
// clear sizes
d->ne = d->nf = d->nl = d->nefc = d->nnzJ = 0;
d->ne = d->nf = d->nl = d->nefc = d->nJ = 0;
// disabled or Jacobian not allocated: return
if (mjDISABLED(mjDSBL_CONSTRAINT)) {
@@ -1951,13 +1951,13 @@ void mj_makeConstraint(const mjModel* m, mjData* d) {
}
// precount sizes for constraint Jacobian matrices
int *nnz = mj_isSparse(m) ? &(d->nnzJ) : NULL;
int *nnz = mj_isSparse(m) ? &(d->nJ) : NULL;
int ne_allocated = mj_ne(m, d, nnz);
int nf_allocated = mj_nf(m, d, nnz);
int nl_allocated = mj_nl(m, d, nnz);
int nefc_allocated = ne_allocated + nf_allocated + nl_allocated + mj_nc(m, d, nnz);
if (!mj_isSparse(m)) {
d->nnzJ = nefc_allocated * m->nv;
d->nJ = nefc_allocated * m->nv;
}
d->nefc = nefc_allocated;
@@ -1998,12 +1998,11 @@ void mj_makeConstraint(const mjModel* m, mjData* d) {
mjERROR("nefc mis-allocation: found nefc=%d but allocated %d", d->nefc, nefc_allocated);
}
// check that nnzJ was computed correctly
// check that nJ was computed correctly
if (d->nefc > 0) {
int nnzJ = d->efc_J_rownnz[d->nefc - 1] + d->efc_J_rowadr[d->nefc - 1];
if (d->nnzJ != nnzJ) {
mjERROR("constraint Jacobian mis-allocation: found nnzJ=%d but allocated %d",
nnzJ, d->nnzJ);
int nJ = d->efc_J_rownnz[d->nefc - 1] + d->efc_J_rowadr[d->nefc - 1];
if (d->nJ != nJ) {
mjERROR("constraint Jacobian mis-allocation: found nJ=%d but allocated %d", nJ, d->nJ);
}
}
} else if (d->nefc > nefc_allocated) {
+1 -1
View File
@@ -1815,7 +1815,7 @@ static void _resetData(const mjModel* m, mjData* d, unsigned char debug_value) {
d->nf = 0;
d->nl = 0;
d->nefc = 0;
d->nnzJ = 0;
d->nJ = 0;
d->nisland = 0;
// clear global properties