same.c
Go to the documentation of this file.
1 /* Oct.16, 1990. definition of error is changed to Euclid norm */
2 /* UNIT is considered when error is evaluated */
3 
4 #include "arith.h"
5 
6 same(w,en,hashtab)
8 int en;
9 TABLE hashtab;
10 {
11  VECTOR w1,w2;
12  REAL error;
13  int i,k,hashkey,hashval;
14 
15  for(i=0; i<MAXRANK; i++)
16  w1[i]= w[i][en];
17 
18  hashval=hash5(w1);
19 
20  for(k=hashval; k<HASHNO; k++){
21  hashkey= hashtab[k];
22  if(hashkey == EMPTY){
23  return(k);
24  }
25  else{
26  error= 0.0e0;
27  for(i=0; i<MAXRANK; i++){
28  w2[i] = w[i][hashkey];
29  error += (w1[i] - w2[i]) * (w1[i] - w2[i]);
30  }
31  if(sqrt(error) < EPS / UNIT)
32  return(COLLISION);
33  }
34  }
35 
36  for(k=0; k<HASHNO; k++){
37  hashkey= hashtab[k];
38  if(hashkey == EMPTY){
39  return(k);
40  }
41  else{
42  error= 0.0e0;
43  for(i=0; i<MAXRANK; i++){
44  w2[i] = w[i][hashkey];
45  error += (w1[i] - w2[i]) * (w1[i] - w2[i]);
46  }
47  if(sqrt(error) < EPS / UNIT)
48  return(COLLISION);
49  }
50  }
51 }
52 
53 
54 
55 
56 
#define EMPTY
Definition: arith.h:21
REAL VECTOR[MAX]
Definition: arith.h:26
double REAL
Definition: arith.h:25
#define MAXEDGE
Definition: arith.h:14
same(w, int en, TABLE hashtab)
Definition: same.c:6
double sqrt()
int TABLE[HASHNO]
Definition: arith.h:29
#define MAXRANK
Definition: arith.h:13
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
Definition: eus.c:297
hash5(VECTOR w)
Definition: hash5.c:6
#define HASHNO
Definition: arith.h:23
#define UNIT
Definition: arith.h:18
#define COLLISION
Definition: arith.h:22
#define EPS
Definition: arith.h:15


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 6 2019 20:00:44