Use banded solver for implicit flex integration.

The flex interpolation stiffness matrix within the implicit/implicitfast solvers is now built and factorized in a banded format instead of a dense one. This involves:
-   Calculating the bandwidth based on the sparsity of the mass/damping matrix and the connectivity within flex cells.
-   Allocating and populating a banded matrix `H`.
-   Using `mju_cholFactorBand` and `mju_cholSolveBand` for factorization and solving.
This change improves performance for flexes with many DOFs but local coupling.

PiperOrigin-RevId: 901297952
Change-Id: I3efe06353d1903ea65ab30dc49685cede228bb68
This commit is contained in:
Alessio Quaglino
2026-04-17 07:59:34 -07:00
committed by Copybara-Service
parent 6c7ed66781
commit b16383dfaf
13 changed files with 239 additions and 33 deletions
+4
View File
@@ -4649,6 +4649,9 @@ struct MjModel {
emscripten::val flex_interp() const {
return emscripten::val(emscripten::typed_memory_view(ptr_->nflex, ptr_->flex_interp));
}
emscripten::val flex_bandwidth() const {
return emscripten::val(emscripten::typed_memory_view(ptr_->nflex, ptr_->flex_bandwidth));
}
emscripten::val flex_cellnum() const {
return emscripten::val(emscripten::typed_memory_view(ptr_->nflex * 3, ptr_->flex_cellnum));
}
@@ -11815,6 +11818,7 @@ EMSCRIPTEN_BINDINGS(mujoco_bindings) {
.property("eq_type", &MjModel::eq_type)
.property("exclude_signature", &MjModel::exclude_signature)
.property("flex_activelayers", &MjModel::flex_activelayers)
.property("flex_bandwidth", &MjModel::flex_bandwidth)
.property("flex_bending", &MjModel::flex_bending)
.property("flex_bvhadr", &MjModel::flex_bvhadr)
.property("flex_bvhnum", &MjModel::flex_bvhnum)