Skip to content

Commit

Permalink
Merge branch 'bugfix/compress-dim-with-spacing-near-epsilon' into rel…
Browse files Browse the repository at this point in the history
…ease/2.7.5
  • Loading branch information
stephen-dixon committed Mar 25, 2024
2 parents 9326845 + 2a725d8 commit 19ebca6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/clientserver/compressDim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ int compress(DIMS* ddim)
return 1;
}
T prev_diff = dim_data[1] - dim_data[0];
T mean_diff = (dim_data[ndata - 1] - dim_data[0]) / (ndata - 1);
double mean_diff = (dim_data[ndata - 1] - dim_data[0]) / (ndata - 1);
T precision = Precision<T>::precision;

bool constant = true;
for (int i = 1; i < ndata; i++) {
T diff = dim_data[i] - dim_data[i - 1];
// avoid trying to compress data where delta is very small
if (diff < 5 * precision)
{
constant = false;
break;
}

T abs_diff = diff < prev_diff ? (prev_diff - diff) : (diff - prev_diff);
if (abs_diff > precision) {
constant = false;
Expand Down

0 comments on commit 19ebca6

Please sign in to comment.