Add internal utility for zeroing int vectors.

PiperOrigin-RevId: 562608956
Change-Id: I25ff1bbf9abf8fe2a636ed1d728d10ae862e04c9
This commit is contained in:
Yuval Tassa
2023-09-04 14:26:19 -07:00
committed by Copybara-Service
parent 1aa375ef9a
commit 9308e1d383
7 changed files with 27 additions and 12 deletions
+2 -1
View File
@@ -22,6 +22,7 @@
#include <mujoco/mjtnum.h>
#include "engine/engine_io.h"
#include "engine/engine_util_blas.h"
#include "engine/engine_util_misc.h"
//------------------------------ sparse operations -------------------------------------------------
@@ -393,7 +394,7 @@ void mju_transposeSparse(mjtNum* res, const mjtNum* mat, int nr, int nc,
int* res_rownnz, int* res_rowadr, int* res_colind,
const int* rownnz, const int* rowadr, const int* colind) {
// clear number of non-zeros for each row of transposed
memset(res_rownnz, 0, nc*sizeof(int));
mju_zeroInt(res_rownnz, nc);
// total number of non-zeros of mat
int nnz = rowadr[nr-1] + rownnz[nr-1];