Skip to content

Commit f912e8d

Browse files
yuvaltassacopybara-github
authored andcommitted
Print sparsity structure of mjData.efc_AR
PiperOrigin-RevId: 713296073 Change-Id: Ifede6ea66dd1177f5e85c8498860decebaa65f06
1 parent 6654d63 commit f912e8d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/engine/engine_print.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,10 +1272,14 @@ void mj_printFormattedData(const mjModel* m, mjData* d, const char* filename,
12721272
d->efc_J_rowadr, d->efc_J_colind, fp, float_format);
12731273
mj_printSparsity("JT: constraint Jacobian transposed", m->nv, d->nefc, d->efc_JT_rowadr, NULL,
12741274
d->efc_JT_rownnz, d->efc_JT_rowsuper, d->efc_JT_colind, fp);
1275-
printArrayInt("EFC_AR_ROWNNZ", d->nefc, 1, d->efc_AR_rownnz, fp);
1276-
printArrayInt("EFC_AR_ROWADR", d->nefc, 1, d->efc_AR_rowadr, fp);
1277-
printSparse("EFC_AR", d->efc_AR, d->nefc, d->efc_AR_rownnz,
1278-
d->efc_AR_rowadr, d->efc_AR_colind, fp, float_format);
1275+
if (mj_isDual(m)) {
1276+
printArrayInt("EFC_AR_ROWNNZ", d->nefc, 1, d->efc_AR_rownnz, fp);
1277+
printArrayInt("EFC_AR_ROWADR", d->nefc, 1, d->efc_AR_rowadr, fp);
1278+
printSparse("EFC_AR", d->efc_AR, d->nefc, d->efc_AR_rownnz,
1279+
d->efc_AR_rowadr, d->efc_AR_colind, fp, float_format);
1280+
mj_printSparsity("efc_AR: inverse constraint inertia", d->nefc, d->nefc, d->efc_AR_rowadr,
1281+
NULL, d->efc_AR_rownnz, NULL, d->efc_AR_colind, fp);
1282+
}
12791283
}
12801284

12811285
printArray("EFC_POS", d->nefc, 1, d->efc_pos, fp, float_format);

0 commit comments

Comments
 (0)