mju_transposeSparse: extract local integer, remove extra blank line.
PiperOrigin-RevId: 506243573 Change-Id: Ia573c9289ef1deb1cc7b5477d441752370caa470
This commit is contained in:
committed by
Copybara-Service
parent
7feecf6e94
commit
a7888d473c
@@ -550,15 +550,13 @@ void mju_transposeSparse(mjtNum* res, const mjtNum* mat, int nr, int nc,
|
|||||||
|
|
||||||
// iterate through each non-zero entry of mat
|
// iterate through each non-zero entry of mat
|
||||||
for (int i = 0; i<nnz; i++) {
|
for (int i = 0; i<nnz; i++) {
|
||||||
|
|
||||||
// iterate to get to the current row (skipping rows with all zeros)
|
// iterate to get to the current row (skipping rows with all zeros)
|
||||||
while ((i-rowadr[r]) >= rownnz[r]) r++;
|
while ((i-rowadr[r]) >= rownnz[r]) r++;
|
||||||
|
|
||||||
// row index becomes the column index
|
// swap rows with columns and increment res_rowadr
|
||||||
res[res_rowadr[colind[i]]] = mat[i];
|
int c = res_rowadr[colind[i]]++;
|
||||||
|
res[c] = mat[i];
|
||||||
// column index becomes the row index (increment the rowadr)
|
res_colind[c] = r;
|
||||||
res_colind[res_rowadr[colind[i]]++] = r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shift back row addresses
|
// shift back row addresses
|
||||||
|
|||||||
Reference in New Issue
Block a user