Provide improved mju_sqrMatTDSparse implementation that doesn't require dense memory allocation for sparse matrices.

PiperOrigin-RevId: 516812783
Change-Id: Ieb43337831d8d3b2c7f18a7facd8e0a0f2b0eff5
This commit is contained in:
Kyle Bayes
2023-03-15 06:55:28 -07:00
committed by Copybara-Service
parent fe18e58ad2
commit 056e849273
7 changed files with 830 additions and 131 deletions
+1 -3
View File
@@ -1699,7 +1699,6 @@ void mj_projectConstraint(const mjModel* m, mjData* d) {
int* rownnzT = (int*)mj_stackAlloc(d, nv);
int* rowadrT = (int*)mj_stackAlloc(d, nv);
int* colindT = (int*)mj_stackAlloc(d, nv*nefc);
int* rowsuperT = (int*)mj_stackAlloc(d, nv);
// construct JM2 = backsubM2(J')' by rows
for (int r=0; r<nefc; r++) {
@@ -1786,12 +1785,11 @@ void mj_projectConstraint(const mjModel* m, mjData* d) {
// construct supernodes
mju_superSparse(nefc, rowsuper, rownnz, rowadr, colind);
mju_superSparse(nv, rowsuperT, rownnzT, rowadrT, colindT);
// AR = JM2 * JM2', uncompressed layout
mju_sqrMatTDSparse(d->efc_AR, JM2T, JM2, NULL, nv, nefc,
d->efc_AR_rownnz, d->efc_AR_rowadr, d->efc_AR_colind,
rownnzT, rowadrT, colindT, rowsuperT,
rownnzT, rowadrT, colindT, NULL,
rownnz, rowadr, colind, rowsuper, d);
// compress layout of AR