Separate mj_addM into dense and sparse functions.

PiperOrigin-RevId: 539066339
Change-Id: Ide3f9644fee46a5fb1a2e79a25be162b929e2421
This commit is contained in:
Kyle Bayes
2023-06-09 06:43:34 -07:00
committed by Copybara-Service
parent 466c9aca82
commit 81d74c56e1
4 changed files with 133 additions and 109 deletions
@@ -20,6 +20,7 @@
#include <absl/base/attributes.h>
#include <mujoco/mjdata.h>
#include <mujoco/mujoco.h>
#include "src/engine/engine_support.h"
#include "src/engine/engine_util_sparse.h"
#include "test/fixture.h"
@@ -458,7 +459,7 @@ static void BM_combineSparse(benchmark::State& state, CombineFuncPtr func) {
d->efc_JT_colind, d->efc_JT_rowsuper, d);
// compute H = M + J'*D*J
mj_addM(m, d, H, rownnz, rowadr, colind);
mj_addMSparse(m, d, H, rownnz, rowadr, colind);
// time benchmark
for (auto s : state) {