diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2008-11-06 23:01:41 +0100 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2008-11-06 23:01:41 +0100 |
commit | d44b4794c679141a08fd802475bb542ecf5b7c51 (patch) | |
tree | 74251970cfbcc58d0252366be6e5e668149b8a48 /match/test.c | |
parent | 63de72d8d810e3692c96c7385b497bb4d68ef54a (diff) | |
download | xorg-input-kobomultitouch-d44b4794c679141a08fd802475bb542ecf5b7c51.tar.gz xorg-input-kobomultitouch-d44b4794c679141a08fd802475bb542ecf5b7c51.tar.bz2 xorg-input-kobomultitouch-d44b4794c679141a08fd802475bb542ecf5b7c51.zip |
ok, fast (but not fastest) matcher in place, no check output...
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'match/test.c')
-rw-r--r-- | match/test.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/match/test.c b/match/test.c new file mode 100644 index 0000000..1544765 --- /dev/null +++ b/match/test.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <time.h> +#include "match.c" + +#define ITS 1000000 + +int main(int argc,char* argv[]) +{ + // column-by-column matrix + float A[DIM2_FINGER]; + float x1[DIM_FINGER]={1,5,2,3,4,5,6,7,8}; + float y1[DIM_FINGER]={1,5,2,3,4,5.1,6,7,8}; + float x2[DIM_FINGER]={1.1,3,2,4,5,6,7,8}; + float y2[DIM_FINGER]={1,3,2,4,5,6,7,8}; + int index[DIM_FINGER]; + int n1 = 4; + int n2 = 7; + + int i, j; + + for (i = 0; i < n1; i++) { + for (j = 0; j < n2; j++) { + A[i + n1 * j] = + (x1[i] - x2[j]) * (x1[i] - x2[j]) + + (y1[i] - y2[j]) * (y1[i] - y2[j]); + } + } + + clock_t t1 = clock(); + for (i = 0; i < ITS; i++) + match_fingers(index, A, n1, n2); + clock_t t2 = clock(); + + printf("%lf matches per second\n", ITS * ((float)CLOCKS_PER_SEC / (t2 - t1))); + + for (i = 0; i < n1; i++) + printf("match[%d] = %d\n", i, index[i]); + + return 0; +} |