Remove trailing spaces in printArray, printArrayInt, printVector, and printSparse.
PiperOrigin-RevId: 512596881 Change-Id: Icfa955628b9a2955df73093b6c8df7751260adfb
This commit is contained in:
committed by
Copybara-Service
parent
2729f9fcf8
commit
7e5419f806
+17
-13
@@ -51,13 +51,14 @@ static void printArray(const char* str, int nr, int nc, const mjtNum* data, FILE
|
||||
return;
|
||||
}
|
||||
if (nr && nc) {
|
||||
fprintf(fp, "%s\n ", str);
|
||||
fprintf(fp, "%s\n", str);
|
||||
for (int r=0; r<nr; r++) {
|
||||
fprintf(fp, " ");
|
||||
for (int c=0; c<nc; c++) {
|
||||
fprintf(fp, float_format, data[c + r*nc]);
|
||||
fprintf(fp, " ");
|
||||
fprintf(fp, float_format, data[c + r*nc]);
|
||||
}
|
||||
fprintf(fp, "\n ");
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
@@ -70,12 +71,14 @@ static void printArrayInt(const char* str, int nr, int nc, const int* data, FILE
|
||||
return;
|
||||
}
|
||||
if (nr && nc) {
|
||||
fprintf(fp, "%s\n ", str);
|
||||
fprintf(fp, "%s\n", str);
|
||||
for (int r=0; r<nr; r++) {
|
||||
fprintf(fp, " ");
|
||||
for (int c=0; c<nc; c++) {
|
||||
fprintf(fp, "%d ", data[c + r*nc]);
|
||||
fprintf(fp, " ");
|
||||
fprintf(fp, "%d", data[c + r*nc]);
|
||||
}
|
||||
fprintf(fp, "\n ");
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
@@ -90,15 +93,16 @@ static void printSparse(const char* str, const mjtNum* mat, int nr,
|
||||
if (!mat) {
|
||||
return;
|
||||
}
|
||||
fprintf(fp, "%s\n ", str);
|
||||
fprintf(fp, "%s\n", str);
|
||||
|
||||
for (int r=0; r<nr; r++) {
|
||||
fprintf(fp, " ");
|
||||
for (int adr=rowadr[r]; adr<rowadr[r]+rownnz[r]; adr++) {
|
||||
fprintf(fp, " ");
|
||||
fprintf(fp, "%d: ", colind[adr]);
|
||||
fprintf(fp, float_format, mat[adr]);
|
||||
fprintf(fp, " ");
|
||||
}
|
||||
fprintf(fp, "\n ");
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
@@ -116,8 +120,8 @@ static void printVector(const char* str, const mjtNum* data, int n, FILE* fp,
|
||||
|
||||
// print data
|
||||
for (int i=0; i<n; i++) {
|
||||
fprintf(fp, float_format, data[i]);
|
||||
fprintf(fp, " ");
|
||||
fprintf(fp, float_format, data[i]);
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
@@ -911,21 +915,21 @@ void mj_printFormattedData(const mjModel* m, mjData* d, const char* filename,
|
||||
// D_rownnz
|
||||
fprintf(fp, NAME_FORMAT, "D_rownnz");
|
||||
for (int i = 0; i < m->nv; i++) {
|
||||
fprintf(fp, "%d ", d->D_rownnz[i]);
|
||||
fprintf(fp, " %d", d->D_rownnz[i]);
|
||||
}
|
||||
fprintf(fp, "\n\n");
|
||||
|
||||
// D_rowadr
|
||||
fprintf(fp, NAME_FORMAT, "D_rowadr");
|
||||
for (int i = 0; i < m->nv; i++) {
|
||||
fprintf(fp, "%d ", d->D_rowadr[i]);
|
||||
fprintf(fp, " %d", d->D_rowadr[i]);
|
||||
}
|
||||
fprintf(fp, "\n\n");
|
||||
|
||||
// D_colind
|
||||
fprintf(fp, NAME_FORMAT, "D_colind");
|
||||
for (int i = 0; i < m->nD; i++) {
|
||||
fprintf(fp, "%d ", d->D_colind[i]);
|
||||
fprintf(fp, " %d", d->D_colind[i]);
|
||||
}
|
||||
fprintf(fp, "\n\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user