A test statistic for a UP/DOWN run is defined in Donald E. Knuth, The Art of Computer Programming Volume 2, 1998, pp. 66-.:
$V= \frac{1}{n} \sum_{i,j\ <=m} \ (COUNT(i)-nb_i)(COUNT(j)-b_j)a_{ij}$
where $m$ is the max length of the runs. But he doesn't describe how matrix $A$ and vector $B$ is defined. How are they defined in an UO/DOWN runtest?