GBOX gbox, gbox1, gbox2;
GSERIALIZED *g1 = NULL;
GSERIALIZED *g2 = NULL;
- int type1, type2;
int empty1 = LW_FALSE;
int empty2 = LW_FALSE;
double xwidth, ywidth;
g1 = (GSERIALIZED*)PG_DETOAST_DATUM(d1);
/* Synchronize our box types */
gbox1.flags = g1->flags;
- /* Read our types */
- type1 = gserialized_get_type(g1);
/* Calculate if the geometry is empty. */
empty1 = gserialized_is_empty(g1);
/* Calculate a geocentric bounds for the objects */
if ( d1 != d2 )
{
g2 = (GSERIALIZED*)PG_DETOAST_DATUM(d2);
- type2 = gserialized_get_type(g2);
gbox2.flags = g2->flags;
empty2 = gserialized_is_empty(g2);
if ( ! empty1 && gserialized_get_gbox_p(g2, &gbox2) == LW_FAILURE )
}
/**
-* Given int array, return sum of values.
+* Given double array, return sum of values.
*/
-static int
-total_int(const int *vals, int nvals)
+static double
+total_double(const double *vals, int nvals)
{
int i;
- int total = 0;
+ float total = 0;
/* Calculate total */
for ( i = 0; i < nvals; i++ )
total += vals[i];
return total;
}
+#if POSTGIS_DEBUG_LEVEL >= 3
+
/**
-* Given double array, return sum of values.
+* Given int array, return sum of values.
*/
-static double
-total_double(const double *vals, int nvals)
+static int
+total_int(const int *vals, int nvals)
{
int i;
- float total = 0;
+ int total = 0;
/* Calculate total */
for ( i = 0; i < nvals; i++ )
total += vals[i];
}
return sqrt(sigma2 / nvals);
}
+#endif /* POSTGIS_DEBUG_LEVEL >= 3 */
/**
* Given a position in the n-d histogram (i,j,k) return the
int counts[num_bins];
double smin, smax; /* Spatial min, spatial max */
double swidth; /* Spatial width of dimension */
+#if POSTGIS_DEBUG_LEVEL >= 3
double average, sdev, sdev_ratio;
+#endif
int bmin, bmax; /* Bin min, bin max */
const ND_BOX *ndb;
/* How dispersed is the distribution of features across bins? */
range = range_quintile(counts, num_bins);
+#if POSTGIS_DEBUG_LEVEL >= 3
average = avg(counts, num_bins);
sdev = stddev(counts, num_bins);
sdev_ratio = sdev/average;
+#endif
POSTGIS_DEBUGF(3, " dimension %d: range = %d", d, range);
POSTGIS_DEBUGF(3, " dimension %d: average = %.6g", d, average);