Skip to content

Commit 47e4131

Browse files
authored
Change to ternary if operator
1 parent 68a00f9 commit 47e4131

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/frolladaptive.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void frolladaptivefun(rollfun_t rfun, unsigned int algo, const double *x, uint64
4040
if (algo==0 && verbose) {
4141
//frolladaptivemaxFast(x, nx, ans, k, fill, narm, hasnf, verbose); // frolladaptivemaxFast does not exists as of now
4242
snprintf(end(ans->message[0]), 500, _("%s: algo fast not implemented, fall back to exact\n"), __func__);
43+
//set algo to 1 to print exact instead of fast in snprinf "fun %s" (line 93)
4344
algo = 1;
4445
}
4546
frolladaptivemaxExact(x, nx, ans, k, fill, narm, hasnf, verbose);
@@ -48,6 +49,7 @@ void frolladaptivefun(rollfun_t rfun, unsigned int algo, const double *x, uint64
4849
if (algo==0 && verbose) {
4950
//frolladaptiveminFast(x, nx, ans, k, fill, narm, hasnf, verbose); // frolladaptiveminFast does not exists as of now
5051
snprintf(end(ans->message[0]), 500, _("%s: algo fast not implemented, fall back to exact\n"), __func__);
52+
//set algo to 1 to print exact instead of fast in snprinf "fun %s" (line 93)
5153
algo = 1;
5254
}
5355
frolladaptiveminExact(x, nx, ans, k, fill, narm, hasnf, verbose);
@@ -88,11 +90,7 @@ void frolladaptivefun(rollfun_t rfun, unsigned int algo, const double *x, uint64
8890
internal_error(__func__, "Unknown rfun value in frolladaptive: %d", rfun); // # nocov
8991
}
9092
if (verbose) {
91-
if(algo == 0)
92-
snprintf(end(ans->message[0]), 500, _("%s: processing fun %s algo %s took %.3fs\n"), __func__, rfunStr, "fast", omp_get_wtime()-tic);
93-
else
94-
snprintf(end(ans->message[0]), 500, _("%s: processing fun %s algo %s took %.3fs\n"), __func__, rfunStr, "exact", omp_get_wtime()-tic);
95-
}
93+
snprintf(end(ans->message[0]), 500, _("%s: processing fun %s algo %s took %.3fs\n"), __func__, rfunStr, (algo == 0) ? "fast" : "exact", omp_get_wtime()-tic);
9694
}
9795

9896

@@ -1050,4 +1048,4 @@ void frolladaptivemedianExact(const double *x, uint64_t nx, ans_t *ans, const in
10501048
free(isna); free(rollnc);
10511049
}
10521050
free(xx);
1053-
}
1051+
}

0 commit comments

Comments
 (0)