From d895888da482572e6f947bec35c94cb33a43034e Mon Sep 17 00:00:00 2001 From: Alessio Date: Tue, 28 Jul 2026 09:14:26 +0100 Subject: [PATCH] Use the inlined mji_ 3x3 helpers throughout engine_derivative.c Convert the four remaining mju_mulMat{,T}{Vec,Mat}3 call sites in this file to their inlined mji_ equivalents, so the file is consistent after the review change to the stretch paths. Aliasing is unaffected: the inlined variants mark the result restrict, and every call already required a distinct result (the public versions overwrite res while reading vec). --- src/engine/engine_derivative.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/engine_derivative.c b/src/engine/engine_derivative.c index 62e0d5f0..17313120 100644 --- a/src/engine/engine_derivative.c +++ b/src/engine/engine_derivative.c @@ -245,7 +245,7 @@ void mjd_subQuat(const mjtNum qa[4], const mjtNum qb[4], mjtNum Da[9], mjtNum Db // add term linear in K * K mjtNum KK[9]; - mju_mulMatMat3(KK, K, K); + mji_mulMatMat3(KK, K, K); mjtNum coef = 1.0 - (half_angle < 6e-8 ? 1.0 : half_angle / mju_tan(half_angle)); mju_addToScl(Da_tmp, KK, coef, 9); @@ -313,7 +313,7 @@ void mjd_quatIntegrate(const mjtNum vel[3], mjtNum scale, if (Dvel || Dscale) Dvel_[i] = b*eye[i] + c*cross[i] + d*outer[i]; } if (Dvel) mju_copy9(Dvel, Dvel_); - if (Dscale) mju_mulMatVec3(Dscale, Dvel_, vel); + if (Dscale) mji_mulMatVec3(Dscale, Dvel_, vel); } @@ -1247,9 +1247,9 @@ static void mjd_flexInterp_kernel(const mjModel* m, mjData* d, } // tmp = K * R - mju_mulMatMat3(tmp, blk, R); + mji_mulMatMat3(tmp, blk, R); // blk = RT * tmp = RT * K * R - mju_mulMatMat3(blk, RT, tmp); + mji_mulMatMat3(blk, RT, tmp); // store in K_rot_cell at (a, b) int adr_out = (3*a)*dim_e + 3*b;