diff --git a/2008-displacement/main.c b/2008-displacement/main.c index ddf1a7f..21100f0 100644 --- a/2008-displacement/main.c +++ b/2008-displacement/main.c @@ -662,12 +662,13 @@ int main(int argc, char *argv[]) for(d = 0; d <= TOTAL; d++) for(e = 0; e <= TOTAL; e++) { + int a2 = a, b2 = b, c2 = c, d2 = d, e2 = e, i; + if(a + b + c + d + e != TOTAL) continue; /* Slightly shuffle our coefficients to avoid waiting until * 75% progress before having an idea of what's going on. */ - int a2 = a, b2 = b, c2 = c, d2 = d, e2 = e; #define SHUFFLE(p,q,n) \ if(p+q) { int tmp = p+q; p = (p+n) % (tmp+1); q = tmp-p; } SHUFFLE(c2, d2, 777); SHUFFLE(b2, d2, 555); @@ -684,26 +685,31 @@ int main(int argc, char *argv[]) #endif /* We only want 4-cell kernels for now */ if(b2) continue; - //printf("K: %d,%d,%d,%d,%d ", a2, b2, c2, d2, e2); - printf("K: %d,%d,%d,%d ", a2, c2, d2, e2); - dest = ed(src, false, a2, 0, - b2, c2, d2, e2, 0, - 0, 0, 0, 0, 0); - if(mode == 4) - { - study(src, dest, 1.2, 0.001, 0., 0.); - } - else + for(i = 1; i <= 2; i++) { - tmp = gauss(src, mat); - tmp2 = gauss(dest, mat); - printf("E: %.5g\n", 1000. * dist(tmp, tmp2, 1.)); - free(tmp); - free(tmp2); + //printf("[%i] K: %d,%d,%d,%d,%d ", i, a2, b2, c2, d2, e2); + printf("[%i] K: %d,%d,%d,%d ", i, a2, c2, d2, e2); + + dest = ed(src, i == 2, a2, 0, + b2, c2, d2, e2, 0, + 0, 0, 0, 0, 0); + if(mode == 4) + { + /* XXX: E_fast is meaningless, ignore it */ + study(src, dest, 1.2, 0.001, 0., 0.); + } + else + { + tmp = gauss(src, mat); + tmp2 = gauss(dest, mat); + printf("E: %.5g\n", 1000. * dist(tmp, tmp2, 1.)); + free(tmp); + free(tmp2); + } + fflush(stdout); + free(dest); } - fflush(stdout); - free(dest); } free(src); diff --git a/2008-displacement/study-4.sh b/2008-displacement/study-4.sh new file mode 100755 index 0000000..72f3bb3 --- /dev/null +++ b/2008-displacement/study-4.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +if [ ! -x ./main ]; then + make main +fi + +if [ "$1" = "" ]; then + echo "Usage: $0 " + exit 1 +fi + +if [ ! -d "$1" ]; then + echo "$0: $1 is not a directory" + exit 1 +fi + +find $1 -type f | while read i; do + OUTPUT="$(echo "$i" | tr -d / | sed 's/^[.]*//').txt" + echo "$0: outputting to $OUTPUT" + + if [ -f "$OUTPUT" ]; then + echo "$0: file already exists, skipping" + continue + fi + + touch "$OUTPUT" + ./main -4 $i | tee -a "$OUTPUT" | while read line; do + echo -n . + done + echo "done." +done +