浏览代码

* Prepare study 4, for exhaustive 4-cell kernel search.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/research@2281 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam 16 年前
父节点
当前提交
325573166b
共有 2 个文件被更改,包括 58 次插入18 次删除
  1. +24
    -18
      2008-displacement/main.c
  2. +34
    -0
      2008-displacement/study-4.sh

+ 24
- 18
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);


+ 34
- 0
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 <directory>"
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


正在加载...
取消
保存