You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AQuery/tests/udf4.a

33 lines
707 B

AGGREGATION FUNCTION covariances2(x, y, w){
xmeans := 0.;
ymeans := 0.;
l := _builtin_len;
if (w > l)
w := l;
elif (w > l + 2)
{
l := 3;
w := 4;
}
elif(w < 99){
l := 8;
}
elif(w<999)
w := 6;
else
l := l / 2;
for (i := 0, j:= 0; i < w; i := i+1) {
xmeans += x[i];
ymeans += y[i];
_builtin_ret[i] := avg (( x(l-w, l) - xmeans ) * (y(l - w, l) - ymeans ));
}
for (i := 0; i < l; i += 1)
{
xmeans += (x[i] - x[i - w]) / w;
ymeans += (y[i] - y[i - w]) / w;
_builtin_ret[i] := avg (( x(l-w, l) - xmeans ) * (y(l - w, l) - ymeans ));
}
Null
}