Implement a more performant mju_transposeSparse that doesn't require dense memory allocation.

PiperOrigin-RevId: 505044194
Change-Id: Ibe0e39e3ad711b2b5bdad45180ca4f83b5c8fc82
This commit is contained in:
Kyle Bayes
2023-01-27 00:19:14 -08:00
committed by Copybara-Service
parent 4b4ee27f64
commit c741dfce7d
5 changed files with 255 additions and 30 deletions
+5 -5
View File
@@ -48,8 +48,8 @@ MJAPI void mju_mulMatVecSparse(mjtNum* res, const mjtNum* mat, const mjtNum* vec
const int* colind, const int* rowsuper);
// compress layout of sparse matrix
void mju_compressSparse(mjtNum* mat, int nr, int nc,
int* rownnz, int* rowadr, int* colind);
MJAPI void mju_compressSparse(mjtNum* mat, int nr, int nc,
int* rownnz, int* rowadr, int* colind);
// combine two sparse vectors: dst = a*dst + b*src, return nnz of result
int mju_combineSparse(mjtNum* dst, const mjtNum* src, int n, mjtNum a, mjtNum b,
@@ -61,9 +61,9 @@ void mju_combineSparseInc(mjtNum* dst, const mjtNum* src, int n, mjtNum a, mjtNu
int dst_nnz, int src_nnz, int* dst_ind, const int* src_ind);
// transpose sparse matrix
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);
MJAPI 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);
// construct row supernodes
void mju_superSparse(int nr, int* rowsuper,