Add mjData.L, sparse Cholesky factor of Newton solver Hessian.

PiperOrigin-RevId: 683669555
Change-Id: I18d7530b5d68d1d48cb95d4faa0150c434109638
This commit is contained in:
Yuval Tassa
2024-10-08 10:12:10 -07:00
committed by Copybara-Service
parent 39af655c1e
commit b66da3d369
9 changed files with 99 additions and 21 deletions
+10 -2
View File
@@ -192,12 +192,13 @@ struct mjData_ {
mjTimerStat timer[mjNTIMER]; // timer statistics
// variable sizes
int ncon; // number of detected contacts
int ne; // number of equality constraints
int nf; // number of friction constraints
int nl; // number of limit constraints
int nefc; // number of constraints
int nnzJ; // number of non-zeros in constraint Jacobian
int ncon; // number of detected contacts
int nnzL; // number of non-zeros in Newton Cholesky factor
int nisland; // number of detected constraint islands
// global properties
@@ -413,12 +414,19 @@ struct mjData_ {
int* island_efcadr; // start address in island_efcind (nisland x 1)
int* island_efcind; // island constraint indices (nefc x 1)
// computed by mj_projectConstraint (dual solver)
// computed by mj_projectConstraint (PGS solver)
int* efc_AR_rownnz; // number of non-zeros in AR (nefc x 1)
int* efc_AR_rowadr; // row start address in colind array (nefc x 1)
int* efc_AR_colind; // column indices in sparse AR (nefc x nefc)
mjtNum* efc_AR; // J*inv(M)*J' + R (nefc x nefc)
// computed by mj_fwdConstraint (Newton solver)
int* L_rownnz; // number of non-zeros in Hessian factor L rows (nv x 1)
int* L_rowadr; // row start address in colind array (nv x 1)
int* L_colind; // column indices in sparse AR (nnzL x 1)
mjtNum* L; // chol(M + J'*diag(efc_D)*J) (nnzL x 1)
mjtNum* Lcone; // L with cone contributions (nnzL x 1)
//-------------------- arena-allocated: POSITION, VELOCITY dependent
// computed by mj_fwdVelocity/mj_referenceConstraint
+13 -3
View File
@@ -680,7 +680,7 @@
X( mjContact, contact, MJ_D(ncon), 1 )
// array fields of mjData that are used in the primal problem
#define MJDATA_ARENA_POINTERS_PRIMAL \
#define MJDATA_ARENA_POINTERS_SOLVER \
X( int, efc_type, MJ_D(nefc), 1 ) \
X( int, efc_id, MJ_D(nefc), 1 ) \
X( int, efc_J_rownnz, MJ_D(nefc), 1 ) \
@@ -707,6 +707,14 @@
X( mjtNum, efc_force, MJ_D(nefc), 1 ) \
X( int, efc_state, MJ_D(nefc), 1 )
// array fields of mjData that are used in the dual problem
#define MJDATA_ARENA_POINTERS_NEWTON \
X( int, L_rownnz, MJ_M(nv), 1 ) \
X( int, L_rowadr, MJ_M(nv), 1 ) \
X( int, L_colind, MJ_D(nnzL), 1 ) \
X( mjtNum, L, MJ_D(nnzL), 1 ) \
X( mjtNum, Lcone, MJ_D(nnzL), 1 )
// array fields of mjData that are used in the dual problem
#define MJDATA_ARENA_POINTERS_DUAL \
X( int, efc_AR_rownnz, MJ_D(nefc), 1 ) \
@@ -729,7 +737,8 @@
// array fields of mjData that live in d->arena
#define MJDATA_ARENA_POINTERS \
MJDATA_ARENA_POINTERS_CONTACT \
MJDATA_ARENA_POINTERS_PRIMAL \
MJDATA_ARENA_POINTERS_SOLVER \
MJDATA_ARENA_POINTERS_NEWTON \
MJDATA_ARENA_POINTERS_DUAL \
MJDATA_ARENA_POINTERS_ISLAND
@@ -747,12 +756,13 @@
X( int, maxuse_con ) \
X( int, maxuse_efc ) \
X( int, solver_nisland ) \
X( int, ncon ) \
X( int, ne ) \
X( int, nf ) \
X( int, nl ) \
X( int, nefc ) \
X( int, nnzJ ) \
X( int, ncon ) \
X( int, nnzL ) \
X( int, nisland ) \
X( mjtNum, time ) \
X( uintptr_t, threadpool )