Delete sparsity structures from mjData, use the ones in mjModel
PiperOrigin-RevId: 795067950 Change-Id: If4f52e40ac49f7c6986b33ef9c8b534199dfd21a
This commit is contained in:
committed by
Copybara-Service
parent
7eb13777f8
commit
977f94e9df
@@ -46,7 +46,7 @@ static void BM_factorI(benchmark::State& state, bool legacy, bool coil) {
|
||||
|
||||
// M: mass matrix in CSR format
|
||||
mjtNum* M = mj_stackAllocNum(d, m->nC);
|
||||
mju_gather(M, d->qM, d->mapM2M, m->nC);
|
||||
mju_gather(M, d->qM, m->mapM2M, m->nC);
|
||||
|
||||
// LDlegacy: legacy LD matrix (size nM)
|
||||
mjtNum* LDlegacy = mj_stackAllocNum(d, m->nM);
|
||||
@@ -59,7 +59,7 @@ static void BM_factorI(benchmark::State& state, bool legacy, bool coil) {
|
||||
} else {
|
||||
mju_copy(d->qLD, M, m->nC);
|
||||
mj_factorI(d->qLD, d->qLDiagInv, m->nv,
|
||||
d->M_rownnz, d->M_rowadr, d->M_colind);
|
||||
m->M_rownnz, m->M_rowadr, m->M_colind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ static void BM_solve(benchmark::State& state, SolveType type) {
|
||||
|
||||
// M: mass matrix in CSR format
|
||||
mjtNum* M = mj_stackAllocNum(d, m->nC);
|
||||
mju_gather(M, d->qM, d->mapM2M, m->nC);
|
||||
mju_gather(M, d->qM, m->mapM2M, m->nC);
|
||||
|
||||
// LDlegacy: legacy LD matrix (size nM)
|
||||
mjtNum* LDlegacy = mj_stackAllocNum(d, m->nM);
|
||||
@@ -73,9 +73,9 @@ static void BM_solve(benchmark::State& state, SolveType type) {
|
||||
case SolveType::kCsr:
|
||||
mju_copy(d->qLD, M, m->nC);
|
||||
mj_factorI(d->qLD, d->qLDiagInv, m->nv,
|
||||
d->M_rownnz, d->M_rowadr, d->M_colind);
|
||||
m->M_rownnz, m->M_rowadr, m->M_colind);
|
||||
mj_solveLD(res, d->qLD, d->qLDiagInv, m->nv, 1,
|
||||
d->M_rownnz, d->M_rowadr, d->M_colind);
|
||||
m->M_rownnz, m->M_rowadr, m->M_colind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ static void BM_solveLD(benchmark::State& state, bool featherstone, bool coil) {
|
||||
// scatter into legacy matrix
|
||||
mjtNum* LDlegacy = mj_stackAllocNum(d, m->nM);
|
||||
mju_zero(LDlegacy, m->nM);
|
||||
mju_scatter(LDlegacy, d->qLD, d->mapM2M, m->nC);
|
||||
mju_scatter(LDlegacy, d->qLD, m->mapM2M, m->nC);
|
||||
|
||||
// benchmark
|
||||
while (state.KeepRunningBatch(kNumBenchmarkSteps)) {
|
||||
@@ -64,7 +64,7 @@ static void BM_solveLD(benchmark::State& state, bool featherstone, bool coil) {
|
||||
mj_solveLD_legacy(m, res, 1, LDlegacy, d->qLDiagInv);
|
||||
} else {
|
||||
mj_solveLD(res, d->qLD, d->qLDiagInv, m->nv, 1,
|
||||
d->M_rownnz, d->M_rowadr, d->M_colind);
|
||||
m->M_rownnz, m->M_rowadr, m->M_colind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user