File: ckd3.pxd

package info (click to toggle)
python-cogent 1.4.1-1.2
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 13,260 kB
  • ctags: 20,087
  • sloc: python: 116,163; ansic: 732; makefile: 74; sh: 9
file content (32 lines) | stat: -rw-r--r-- 924 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
cimport numpy as np
ctypedef np.npy_float64 DTYPE_t
ctypedef np.npy_uint64  UTYPE_t

cdef enum constants:
    NSTACK = 100

cdef struct kdpoint:
    UTYPE_t index
    DTYPE_t *coords

cdef struct kdnode:
    UTYPE_t bucket                 # 1 if leaf-bucket, 0 if node
    int dimension
    DTYPE_t position
    UTYPE_t start, end             # start and end index of data points
    kdnode *left, *right           # pointers to left and right nodes

cdef inline void swap(kdpoint*, kdpoint*)

cdef kdpoint *points(DTYPE_t*, UTYPE_t, UTYPE_t)

cdef inline DTYPE_t dist(kdpoint*, kdpoint*, UTYPE_t)

cdef void qsort(kdpoint*, UTYPE_t, UTYPE_t, UTYPE_t)

cdef kdnode *build_tree(kdpoint*, UTYPE_t, UTYPE_t, UTYPE_t, UTYPE_t, UTYPE_t)

cdef UTYPE_t rn(kdnode*, kdpoint*, kdpoint, DTYPE_t**,UTYPE_t**, DTYPE_t, UTYPE_t, UTYPE_t)
                
cdef void *knn(kdnode*, kdpoint*, kdpoint, DTYPE_t*, UTYPE_t*, UTYPE_t, UTYPE_t)