We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1402f3c commit 20fbdbdCopy full SHA for 20fbdbd
kite/ext/covariance.c
@@ -27,6 +27,13 @@ uint32_t finished_combinations = 0;
27
typedef npy_float32 float32_t;
28
typedef npy_float64 float64_t;
29
30
+#ifndef max
31
+ #define max(a,b) \
32
+ ({ __typeof__ (a) _a = (a); \
33
+ __typeof__ (b) _b = (b); \
34
+ _a > _b ? _a : _b; })
35
+#endif
36
+
37
typedef enum {
38
SUCCESS = 0,
39
SAUBSAMPLING_SPARSE_ERROR
@@ -127,7 +134,7 @@ static state_covariance calc_covariance_matrix(
127
134
for (il1=0; il1<nleaves; il1++) {
128
135
if (adaptive_subsampling) {
129
136
l_length = map[il1*4+1] - map[il1*4+0];
130
- subsampling[il1] = ceil(LOG2(l_length));
137
+ subsampling[il1] = max(ceil(LOG2(l_length)), 1);
131
138
} else {
132
139
subsampling[il1] = 1;
133
140
}
0 commit comments