File: ewah_bool_wrap.pxd

package info (click to toggle)
python-ewah-bool-utils 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 448 kB
  • sloc: cpp: 1,709; ansic: 926; python: 219; makefile: 16
file content (163 lines) | stat: -rw-r--r-- 7,752 bytes parent folder | download | duplicates (2)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
cimport numpy as np
from libcpp.pair cimport pair
from libcpp.set cimport set as cset
from libcpp.vector cimport vector

from ewah_bool_utils.ewah_bool_array cimport (
    ewah_bool_array,
    ewah_bool_iterator,
    ewah_map,
    sstream,
)

ctypedef bint bitarrtype
ctypedef pair[np.uint64_t, np.uint64_t] ind_pair

cdef class FileBitmasks:
    cdef np.uint32_t nfiles
    cdef ewah_map** ewah_coll
    cdef ewah_bool_array** ewah_keys
    cdef ewah_bool_array** ewah_refn

    cdef void _reset(self)
    cdef bint _iseq(self, FileBitmasks solf)
    cdef BoolArrayCollection _get_bitmask(self, np.uint32_t ifile)
    cdef tuple _find_collisions(self, BoolArrayCollection coll, bint verbose=*)
    cdef tuple _find_collisions_coarse(self, BoolArrayCollection coll, bint
                verbose=*, file_list=*)
    cdef tuple _find_collisions_refined(self, BoolArrayCollection coll, bint verbose=*)
    cdef void _set(self, np.uint32_t ifile, np.uint64_t i1, np.uint64_t i2=*)
    cdef void _set_coarse(self, np.uint32_t ifile, np.uint64_t i1)
    cdef void _set_refined(self, np.uint32_t ifile, np.uint64_t i1, np.uint64_t i2)
    cdef void _set_coarse_array(self, np.uint32_t ifile, np.uint8_t[:] arr)
    cdef void _set_refined_array(self, np.uint32_t ifile, np.uint64_t mi1, np.uint8_t[:] arr)
    cdef void _set_refined_index_array(self, np.uint32_t ifile, np.int64_t nsub_mi,
                                       np.ndarray[np.uint64_t, ndim=1] sub_mi1,
                                       np.ndarray[np.uint64_t, ndim=1] sub_mi2)
    cdef void _set_map(self, np.uint32_t ifile, np.uint64_t i1, np.uint64_t i2)
    cdef void _set_refn(self, np.uint32_t ifile, np.uint64_t i1)
    cdef bint _get(self, np.uint32_t ifile, np.uint64_t i1, np.uint64_t i2=*)
    cdef bint _get_coarse(self, np.uint32_t ifile, np.uint64_t i1)
    cdef void _get_coarse_array(self, np.uint32_t ifile, np.uint64_t imax, np.uint8_t[:] arr) except *
    cdef bint _isref(self, np.uint32_t ifile, np.uint64_t i)
    cdef np.uint64_t _count_total(self, np.uint32_t ifile)
    cdef np.uint64_t _count_refined(self, np.uint32_t ifile)
    cdef np.uint64_t _count_coarse(self, np.uint32_t ifile)
    cdef void _append(self, np.uint32_t ifile, BoolArrayCollection solf)
    cdef bint _intersects(self, np.uint32_t ifile, BoolArrayCollection solf)
    cdef void _logicalxor(self, np.uint32_t ifile, BoolArrayCollection solf, BoolArrayCollection out)
    cdef void _logicaland(self, np.uint32_t ifile, BoolArrayCollection solf, BoolArrayCollection out)
    cdef void _select_contaminated(self, np.uint32_t ifile, BoolArrayCollection mask, np.uint8_t[:] out,
               np.uint8_t[:] secondary_files, BoolArrayCollection mask2=*)
    cdef void _select_uncontaminated(self, np.uint32_t ifile, BoolArrayCollection mask, np.uint8_t[:] out,
               BoolArrayCollection mask2=*)
    cdef bytes _dumps(self, np.uint32_t ifile)
    cdef bint _loads(self, np.uint32_t ifile, bytes s)
    cdef bint _check(self)

cdef class BoolArrayCollection:
    cdef ewah_map* ewah_coll
    cdef ewah_bool_array* ewah_keys
    cdef ewah_bool_array* ewah_refn
    cdef ewah_bool_array* ewah_coar

    cdef void _reset(self)
    cdef int _richcmp(self, BoolArrayCollection solf, int op) except -1
    cdef void _set(self, np.uint64_t i1, np.uint64_t i2=*)
    cdef void _set_coarse(self, np.uint64_t i1)
    cdef void _set_refined(self, np.uint64_t i1, np.uint64_t i2)
    cdef void _set_coarse_array(self, np.uint8_t[:] arr)
    cdef void _set_refined_array(self, np.uint64_t mi1, np.uint8_t[:] arr)
    cdef void _set_map(self, np.uint64_t i1, np.uint64_t i2)
    cdef void _set_refn(self, np.uint64_t i1)
    cdef bint _get(self, np.uint64_t i1, np.uint64_t i2=*)
    cdef bint _get_coarse(self, np.uint64_t i1)
    cdef void _get_coarse_array(self, np.uint64_t imax, np.uint8_t[:] arr) except *
    cdef bint _contains(self, np.uint64_t i)
    cdef bint _isref(self, np.uint64_t i)
    cdef void _ewah_coarse(self)
    cdef np.uint64_t _count_total(self)
    cdef np.uint64_t _count_refined(self)
    cdef np.uint64_t _count_coarse(self)
    cdef void _append(self, BoolArrayCollection solf)
    cdef void _logicalor(self, BoolArrayCollection solf, BoolArrayCollection out)
    cdef bint _intersects(self, BoolArrayCollection solf)
    cdef void _logicalxor(self, BoolArrayCollection solf, BoolArrayCollection out)
    cdef void _logicaland(self, BoolArrayCollection solf, BoolArrayCollection out)
    cdef void _select_contaminated(self, BoolArrayCollection mask, np.uint8_t[:] out,
        BoolArrayCollection mask2=*)
    cdef void _select_uncontaminated(self, BoolArrayCollection mask, np.uint8_t[:] out,
        BoolArrayCollection mask2=*)
    cdef void _get_ghost_zones(self, int ngz, int order1, int order2,
                               bint periodicity[3], BoolArrayCollection out_ewah,
                               bint coarse_ghosts=*)
    cdef bytes _dumps(self)
    cdef bint _loads(self, bytes s)
    cdef bint _check(self)

cdef class BoolArrayCollectionUncompressed:
    cdef int nele1
    cdef int nele2
    cdef ewah_map* ewah_coll
    cdef bitarrtype* ewah_keys
    cdef bitarrtype* ewah_refn

    cdef void _set(self, np.uint64_t i1, np.uint64_t i2=*)
    cdef void _set_coarse(self, np.uint64_t i1)
    cdef void _set_refined(self, np.uint64_t i1, np.uint64_t i2)
    cdef void _set_coarse_array(self, np.uint8_t[:] arr)
    cdef void _set_coarse_array_ptr(self, np.uint8_t *arr)
    cdef void _set_refined_array(self, np.uint64_t mi1, np.uint8_t[:] arr)
    cdef void _set_refined_array_ptr(self, np.uint64_t mi1, np.uint8_t *arr)
    cdef void _set_map(self, np.uint64_t i1, np.uint64_t i2)
    cdef void _set_refn(self, np.uint64_t i1)
    cdef bint _get(self, np.uint64_t i1, np.uint64_t i2=*)
    cdef bint _get_coarse(self, np.uint64_t i1)
    cdef bint _isref(self, np.uint64_t i)
    cdef np.uint64_t _count_total(self)
    cdef np.uint64_t _count_refined(self)
    cdef void _append(self, BoolArrayCollectionUncompressed solf)
    cdef bint _intersects(self, BoolArrayCollectionUncompressed solf)
    cdef void _compress(self, BoolArrayCollection solf)

cdef class SparseUnorderedBitmaskSet:
    cdef cset[np.uint64_t] entries
    cdef void _set(self, np.uint64_t ind)
    cdef void _fill(self, np.uint8_t[:] mask)
    cdef void _fill_ewah(self, BoolArrayCollection mm)
    cdef void _fill_bool(self, BoolArrayCollectionUncompressed mm)
    cdef void _reset(self)
    cdef to_array(self)

cdef class SparseUnorderedBitmaskVector:
    cdef int total
    cdef vector[np.uint64_t] entries
    cdef void _set(self, np.uint64_t ind)
    cdef void _fill(self, np.uint8_t[:] mask)
    cdef void _fill_ewah(self, BoolArrayCollection mm)
    cdef void _fill_bool(self, BoolArrayCollectionUncompressed mm)
    cdef void _reset(self)
    cdef to_array(self)
    cdef void _remove_duplicates(self)
    cdef void _prune(self)

cdef class SparseUnorderedRefinedBitmaskSet:
    cdef cset[ind_pair] entries
    cdef void _set(self, np.uint64_t ind1, np.uint64_t ind2)
    cdef void _fill(self, np.uint8_t[:] mask1, np.uint8_t[:])
    cdef void _fill_ewah(self, BoolArrayCollection mm)
    cdef void _fill_bool(self, BoolArrayCollectionUncompressed mm)
    cdef void _reset(self)
    cdef to_array(self)

cdef class SparseUnorderedRefinedBitmaskVector:
    cdef int total
    cdef vector[ind_pair] entries
    cdef void _set(self, np.uint64_t ind1, np.uint64_t ind2)
    cdef void _fill(self, np.uint8_t[:] mask1, np.uint8_t[:])
    cdef void _fill_ewah(self, BoolArrayCollection mm)
    cdef void _fill_bool(self, BoolArrayCollectionUncompressed mm)
    cdef void _reset(self)
    cdef to_array(self)
    cdef void _remove_duplicates(self)
    cdef void _prune(self)