Changeset 1172
- Timestamp:
- 04/22/22 17:42:13 (2 years ago)
- Location:
- cpp/frams/model/similarity/EMD
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/similarity/EMD/emd.c
r1130 r1172 147 147 } 148 148 149 if (itr == MAX_ITERATIONS) 150 fprintf(stderr, "emd: Maximum number of iterations has been reached (%d)\n", 151 MAX_ITERATIONS); 152 } 149 if (itr == MAX_ITERATIONS) //print a warning message 150 { 151 #define EMD_LIMIT_WARNING_MESSAGES 10 //if thousands of such messages are printed, we group them to avoid spamming stderr. Undefine (comment out) to disable. 152 #ifdef EMD_LIMIT_WARNING_MESSAGES 153 static int warncounter = 0; 154 static int warnnextlimit = 1; 155 warncounter++; 156 if (warncounter == warnnextlimit) 157 { 158 fprintf(stderr, "[repeated %dx in total, next warning at %dx] ", warncounter, warnnextlimit * EMD_LIMIT_WARNING_MESSAGES); 159 #endif 160 fprintf(stderr, "emd: Maximum number of iterations (%d) has been reached\n", MAX_ITERATIONS); 161 #ifdef EMD_LIMIT_WARNING_MESSAGES 162 warnnextlimit *= EMD_LIMIT_WARNING_MESSAGES; 163 } 164 #endif 165 } 166 } 153 167 154 168 /* COMPUTE THE TOTAL FLOW */ -
cpp/frams/model/similarity/EMD/emd.h
r1064 r1172 19 19 // r1050: Renamed variables that caused problems with g++ 7.3.0 20 20 // r1062: Global static arrays moved to a function and now allocated dynamically; removed #defined limit of MAX_SIG_SIZE=1000 21 // r1172: Introduced EMD_LIMIT_WARNING_MESSAGES to limit the number of warning messages printed to stderr: "emd: Maximum number of iterations has been reached" 21 22 22 23
Note: See TracChangeset
for help on using the changeset viewer.