Sparse ten_J and ten_J_colind memory

PiperOrigin-RevId: 868834376
Change-Id: Iec92d9e09e3134666895e54a78cb02439d74a4de
This commit is contained in:
Google DeepMind
2026-02-11 14:04:45 -08:00
committed by Copybara-Service
parent b466829482
commit 336e1026a4
21 changed files with 43 additions and 118 deletions
-12
View File
@@ -3226,16 +3226,7 @@ int mjCModel::CountNJmom(const mjModel* m) {
return count;
}
// compute non-zeros in ten_J matrix
int mjCModel::CountNJten(const mjModel* m) {
int nv = m->nv;
int ntendon = m->ntendon;
// conservative upper bound: each tendon can have at most nv non-zeros
// TODO(taylorhowell): compute tighter bound
int count = ntendon * nv;
return count;
}
// copy objects outside kinematic tree
void mjCModel::CopyObjects(mjModel* m) {
@@ -5046,9 +5037,6 @@ void mjCModel::TryCompile(mjModel*& m, mjData*& d, const mjVFS* vfs) {
// compute non-zeros in actuator_moment
m->nJmom = nJmom = CountNJmom(m);
// compute non-zeros in ten_J
m->nJten = nJten = CountNJten(m);
// scale mass
if (compiler.settotalmass > 0) {
mj_setTotalmass(m, compiler.settotalmass);