PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ quantile_llist_index_search()

static struct quantile_llist_element * quantile_llist_index_search ( struct quantile_llist qll,
double  value,
uint32_t *  index 
)
static

Definition at line 937 of file rt_statistics.c.

941 {
942 uint32_t i = 0, j = 0;
943 RASTER_DEBUGF(5, "searching index for value %f", value);
944
945 for (i = 0; i < qll->index_max; i++) {
946 if (NULL == qll->index[i].element) {
947 if (i < 1) break;
948 continue;
949 }
950 if (value > (qll->index[i]).element->value) continue;
951
952 if (FLT_EQ(value, qll->index[i].element->value)) {
953 RASTER_DEBUGF(5, "using index value at %d = %f", i, qll->index[i].element->value);
954 *index = i * 100;
955 return qll->index[i].element;
956 }
957 else if (i > 0) {
958 for (j = 1; j < i; j++) {
959 if (NULL != qll->index[i - j].element) {
960 RASTER_DEBUGF(5, "using index value at %d = %f", i - j, qll->index[i - j].element->value);
961 *index = (i - j) * 100;
962 return qll->index[i - j].element;
963 }
964 }
965 }
966 }
967
968 *index = 0;
969 return qll->head;
970}
#define RASTER_DEBUGF(level, msg,...)
Definition librtcore.h:308
#define FLT_EQ(x, y)
Definition librtcore.h:2436
struct quantile_llist_element * element
Definition librtcore.h:2620
uint32_t index_max
Definition librtcore.h:2605
struct quantile_llist_element * head
Definition librtcore.h:2599
struct quantile_llist_index * index
Definition librtcore.h:2604

References quantile_llist_index::element, FLT_EQ, quantile_llist::head, quantile_llist::index, quantile_llist::index_max, RASTER_DEBUGF, and quantile_llist_element::value.

Referenced by rt_band_get_quantiles_stream().

Here is the caller graph for this function: