Add mju_sym2dense, document future breakage of mj_fullM

PiperOrigin-RevId: 910242375
Change-Id: Ibfbdef9cfb66088723499ea257da09aee0d80938
This commit is contained in:
Yuval Tassa
2026-05-04 14:25:23 -07:00
committed by Copybara-Service
parent a51a7bf062
commit 767c607f58
19 changed files with 191 additions and 12 deletions
+17
View File
@@ -140,6 +140,23 @@ void mju_sparse2dense(mjtNum* res, const mjtNum* mat, int nr, int nc,
}
// convert lower-triangular symmetric CSR matrix to full dense matrix
void mju_sym2dense(mjtNum* res, const mjtNum* mat, int n,
const int* rownnz, const int* rowadr, const int* colind) {
mju_zero(res, n*n);
for (int i = 0; i < n; i++) {
int adr = rowadr[i];
for (int j = 0; j < rownnz[i]; j++) {
int col = colind[adr+j];
if (col <= i) {
res[i*n+col] = mat[adr+j];
res[col*n+i] = mat[adr+j];
}
}
}
}
// res[row, :] = mat[row, :]
void mju_copySparse(mjtNum* res, const mjtNum* mat, const int* rownnz, const int* rowadr,
const int* row, int nrow) {