#!/bin/bash set -e BLKY_FLAGS="${BLKY_FLAGS}" echo "this will take 4 hours" > /dev/stderr function count_bits() { err=$((0)) for i in $(seq 0 7); do if [[ $(($1 & (1 << $i))) > 0 ]]; then err=$((err + 1)) fi done echo $err } function proc() { err=$((0)) for i in $(seq 0 255); do v=$(printf "%02x" ${i} | \ ${BLKY} ${BLKY_FLAGS} --from bytes --stdin-hex --to feature-probs --stdout \ --probgen-false-positive $(printf "0.%02d" ${1}) \ --probgen-false-negative $(printf "0.%02d" ${2}) | \ ${BLKY} ${BLKY_FLAGS} --from feature-probs --stdin --to bytes --stdout-hex) err=$((err + $(count_bits $(($i ^ 16#$v))))) done printf "0.%02d 0.%02d %d\n" ${fn} ${fp} ${err} } for fn in $(seq 0 50); do for fp in $(seq 0 50); do until [ "$( jobs -lr 2>&1 | wc -l)" -lt 4 ]; do sleep 0.5 done proc ${fp} ${fn} & done done