hashtable.pxd 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. cpdef get_item(self, uint64_t val)
  41. cpdef set_item(self, uint64_t key, Py_ssize_t val)
  42. cdef class Int64HashTable(HashTable):
  43. cdef kh_int64_t *table
  44. cpdef get_item(self, int64_t val)
  45. cpdef set_item(self, int64_t key, Py_ssize_t val)
  46. cdef class UInt32HashTable(HashTable):
  47. cdef kh_uint32_t *table
  48. cpdef get_item(self, uint32_t val)
  49. cpdef set_item(self, uint32_t key, Py_ssize_t val)
  50. cdef class Int32HashTable(HashTable):
  51. cdef kh_int32_t *table
  52. cpdef get_item(self, int32_t val)
  53. cpdef set_item(self, int32_t key, Py_ssize_t val)
  54. cdef class UInt16HashTable(HashTable):
  55. cdef kh_uint16_t *table
  56. cpdef get_item(self, uint16_t val)
  57. cpdef set_item(self, uint16_t key, Py_ssize_t val)
  58. cdef class Int16HashTable(HashTable):
  59. cdef kh_int16_t *table
  60. cpdef get_item(self, int16_t val)
  61. cpdef set_item(self, int16_t key, Py_ssize_t val)
  62. cdef class UInt8HashTable(HashTable):
  63. cdef kh_uint8_t *table
  64. cpdef get_item(self, uint8_t val)
  65. cpdef set_item(self, uint8_t key, Py_ssize_t val)
  66. cdef class Int8HashTable(HashTable):
  67. cdef kh_int8_t *table
  68. cpdef get_item(self, int8_t val)
  69. cpdef set_item(self, int8_t key, Py_ssize_t val)
  70. cdef class Float64HashTable(HashTable):
  71. cdef kh_float64_t *table
  72. cpdef get_item(self, float64_t val)
  73. cpdef set_item(self, float64_t key, Py_ssize_t val)
  74. cdef class Float32HashTable(HashTable):
  75. cdef kh_float32_t *table
  76. cpdef get_item(self, float32_t val)
  77. cpdef set_item(self, float32_t key, Py_ssize_t val)
  78. cdef class Complex64HashTable(HashTable):
  79. cdef kh_complex64_t *table
  80. cpdef get_item(self, complex64_t val)
  81. cpdef set_item(self, complex64_t key, Py_ssize_t val)
  82. cdef class Complex128HashTable(HashTable):
  83. cdef kh_complex128_t *table
  84. cpdef get_item(self, complex128_t val)
  85. cpdef set_item(self, complex128_t key, Py_ssize_t val)
  86. cdef class PyObjectHashTable(HashTable):
  87. cdef kh_pymap_t *table
  88. cpdef get_item(self, object val)
  89. cpdef set_item(self, object key, Py_ssize_t val)
  90. cdef class StringHashTable(HashTable):
  91. cdef kh_str_t *table
  92. cpdef get_item(self, str val)
  93. cpdef set_item(self, str key, Py_ssize_t val)
  94. cdef struct Int64VectorData:
  95. int64_t *data
  96. Py_ssize_t n, m
  97. cdef class Vector:
  98. cdef bint external_view_exists
  99. cdef class Int64Vector(Vector):
  100. cdef Int64VectorData *data
  101. cdef ndarray ao
  102. cdef resize(self)
  103. cpdef ndarray to_array(self)
  104. cdef inline void append(self, int64_t x)
  105. cdef extend(self, int64_t[:] x)