home *** CD-ROM | disk | FTP | other *** search
/ Los Alamos National Laboratory / LANL_CD.ISO / software / compres / src / encode_k.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-11  |  581 b   |  25 lines

  1. /****************************************************************
  2.  
  3. COPYRIGHT (C) 1992 UNIVERSITY OF CALIFORNIA
  4.  
  5. ***************************************************************/
  6.  
  7. #include "kdnode.h"
  8.  
  9. encode_kd(x, indices, nvec, cbook, k, ncv)
  10. int *indices, k, ncv, nvec;
  11. float *x, *cbook;
  12. {
  13.     int FindClosestVector(), *max;
  14.     float dist;
  15.     struct KDTreeNode *tree, *MakeMedianTree();
  16.  
  17.     tree = MakeMedianTree(k, ncv, cbook);
  18.  
  19.     max = indices + nvec;
  20.     while(indices < max) {
  21.         *indices++ = FindClosestVector(tree, k, ncv, cbook, x, &dist);
  22.         x += k;
  23.     }
  24. }
  25.