MCPcopy Create free account
hub / github.com/FreeFem/FreeFem-sources / Sorted_index

Function Sorted_index

plugin/seq/cmaes.cpp:3206–3220  ·  view source on GitHub ↗

dirty index sort */

Source from the content-addressed store, hash-verified

3204#if 1
3205/* dirty index sort */
3206static void Sorted_index(const double *rgFunVal, int *iindex, int n) {
3207 int i, j;
3208
3209 for (i = 1, iindex[0] = 0; i < n; ++i) {
3210 for (j = i; j > 0; --j) {
3211 if (rgFunVal[iindex[j - 1]] < rgFunVal[i]) {
3212 break;
3213 }
3214
3215 iindex[j] = iindex[j - 1]; /* shift up */
3216 }
3217
3218 iindex[j] = i; /* insert i */
3219 }
3220}
3221
3222#endif
3223

Callers 2

cmaes_UpdateDistributionFunction · 0.85
cmaes_WriteToFilePtrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected