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


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43