hashtable.pxd 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. from numpy cimport (
  2. intp_t,
  3. ndarray,
  4. )
  5. from pandas._libs.khash cimport (
  6. complex64_t,
  7. complex128_t,
  8. float32_t,
  9. float64_t,
  10. int8_t,
  11. int16_t,
  12. int32_t,
  13. int64_t,
  14. kh_complex64_t,
  15. kh_complex128_t,
  16. kh_float32_t,
  17. kh_float64_t,
  18. kh_int8_t,
  19. kh_int16_t,
  20. kh_int32_t,
  21. kh_int64_t,
  22. kh_pymap_t,
  23. kh_str_t,
  24. kh_uint8_t,
  25. kh_uint16_t,
  26. kh_uint32_t,
  27. kh_uint64_t,
  28. khcomplex64_t,
  29. khcomplex128_t,
  30. uint8_t,
  31. uint16_t,
  32. uint32_t,
  33. uint64_t,
  34. )
  35. # prototypes for sharing
  36. cdef class HashTable:
  37. pass
  38. cdef class UInt64HashTable(HashTable):
  39. cdef kh_uint64_t *table
  40. cdef int64_t na_position
  41. cdef bint uses_mask
  42. cpdef get_item(self, uint64_t val)
  43. cpdef set_item(self, uint64_t key, Py_ssize_t val)
  44. cpdef get_na(self)
  45. cpdef set_na(self, Py_ssize_t val)
  46. cdef class Int64HashTable(HashTable):
  47. cdef kh_int64_t *table
  48. cdef int64_t na_position
  49. cdef bint uses_mask
  50. cpdef get_item(self, int64_t val)
  51. cpdef set_item(self, int64_t key, Py_ssize_t val)
  52. cpdef get_na(self)
  53. cpdef set_na(self, Py_ssize_t val)
  54. cdef class UInt32HashTable(HashTable):
  55. cdef kh_uint32_t *table
  56. cdef int64_t na_position
  57. cdef bint uses_mask
  58. cpdef get_item(self, uint32_t val)
  59. cpdef set_item(self, uint32_t key, Py_ssize_t val)
  60. cpdef get_na(self)
  61. cpdef set_na(self, Py_ssize_t val)
  62. cdef class Int32HashTable(HashTable):
  63. cdef kh_int32_t *table
  64. cdef int64_t na_position
  65. cdef bint uses_mask
  66. cpdef get_item(self, int32_t val)
  67. cpdef set_item(self, int32_t key, Py_ssize_t val)
  68. cpdef get_na(self)
  69. cpdef set_na(self, Py_ssize_t val)
  70. cdef class UInt16HashTable(HashTable):
  71. cdef kh_uint16_t *table
  72. cdef int64_t na_position
  73. cdef bint uses_mask
  74. cpdef get_item(self, uint16_t val)
  75. cpdef set_item(self, uint16_t key, Py_ssize_t val)
  76. cpdef get_na(self)
  77. cpdef set_na(self, Py_ssize_t val)
  78. cdef class Int16HashTable(HashTable):
  79. cdef kh_int16_t *table
  80. cdef int64_t na_position
  81. cdef bint uses_mask
  82. cpdef get_item(self, int16_t val)
  83. cpdef set_item(self, int16_t key, Py_ssize_t val)
  84. cpdef get_na(self)
  85. cpdef set_na(self, Py_ssize_t val)
  86. cdef class UInt8HashTable(HashTable):
  87. cdef kh_uint8_t *table
  88. cdef int64_t na_position
  89. cdef bint uses_mask
  90. cpdef get_item(self, uint8_t val)
  91. cpdef set_item(self, uint8_t key, Py_ssize_t val)
  92. cpdef get_na(self)
  93. cpdef set_na(self, Py_ssize_t val)
  94. cdef class Int8HashTable(HashTable):
  95. cdef kh_int8_t *table
  96. cdef int64_t na_position
  97. cdef bint uses_mask
  98. cpdef get_item(self, int8_t val)
  99. cpdef set_item(self, int8_t key, Py_ssize_t val)
  100. cpdef get_na(self)
  101. cpdef set_na(self, Py_ssize_t val)
  102. cdef class Float64HashTable(HashTable):
  103. cdef kh_float64_t *table
  104. cdef int64_t na_position
  105. cdef bint uses_mask
  106. cpdef get_item(self, float64_t val)
  107. cpdef set_item(self, float64_t key, Py_ssize_t val)
  108. cpdef get_na(self)
  109. cpdef set_na(self, Py_ssize_t val)
  110. cdef class Float32HashTable(HashTable):
  111. cdef kh_float32_t *table
  112. cdef int64_t na_position
  113. cdef bint uses_mask
  114. cpdef get_item(self, float32_t val)
  115. cpdef set_item(self, float32_t key, Py_ssize_t val)
  116. cpdef get_na(self)
  117. cpdef set_na(self, Py_ssize_t val)
  118. cdef class Complex64HashTable(HashTable):
  119. cdef kh_complex64_t *table
  120. cdef int64_t na_position
  121. cdef bint uses_mask
  122. cpdef get_item(self, complex64_t val)
  123. cpdef set_item(self, complex64_t key, Py_ssize_t val)
  124. cpdef get_na(self)
  125. cpdef set_na(self, Py_ssize_t val)
  126. cdef class Complex128HashTable(HashTable):
  127. cdef kh_complex128_t *table
  128. cdef int64_t na_position
  129. cdef bint uses_mask
  130. cpdef get_item(self, complex128_t val)
  131. cpdef set_item(self, complex128_t key, Py_ssize_t val)
  132. cpdef get_na(self)
  133. cpdef set_na(self, Py_ssize_t val)
  134. cdef class PyObjectHashTable(HashTable):
  135. cdef kh_pymap_t *table
  136. cpdef get_item(self, object val)
  137. cpdef set_item(self, object key, Py_ssize_t val)
  138. cdef class StringHashTable(HashTable):
  139. cdef kh_str_t *table
  140. cpdef get_item(self, str val)
  141. cpdef set_item(self, str key, Py_ssize_t val)
  142. cdef struct Int64VectorData:
  143. int64_t *data
  144. Py_ssize_t n, m
  145. cdef class Vector:
  146. cdef bint external_view_exists
  147. cdef class Int64Vector(Vector):
  148. cdef Int64VectorData *data
  149. cdef ndarray ao
  150. cdef resize(self)
  151. cpdef ndarray to_array(self)
  152. cdef void append(self, int64_t x)
  153. cdef extend(self, int64_t[:] x)