File: usage.rst

package info (click to toggle)
python-ewah-bool-utils 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 448 kB
  • sloc: cpp: 1,709; ansic: 926; python: 249; makefile: 16
file content (36 lines) | stat: -rw-r--r-- 847 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
=====
Usage
=====

Set from an integer numpy array::

    from ewah_bool_utils.ewah_bool_array cimport ewah_bool_array

    cdef ewah_bool_array *ewah_array

    ewah_array = new ewah_bool_array()

    for i2 in range(numpy_array.shape[0]):
    	i1 = numpy_array[i2]
    	ewah_array[0].set(i1)

Unset an EWAH array::

    from libcpp.vector cimport vector
    from ewah_bool_utils.ewah_bool_array cimport ewah_bool_array
    import numpy as np

    cdef vector[size_t] vec

    vec = ewah_array[0].toArray()
    numpy_array = np.array(vec, 'uint64')

Find the number of collisions between two EWAH arrays::

    from ewah_bool_utils.ewah_bool_array cimport ewah_bool_array

    cdef ewah_bool_array ewah_array_keys
    cdef int ncoll

    ewah_array2[0].logicaland(ewah_array1[0], ewah_array_keys[0])
    ncoll = ewah_array_keys[0].numberOfOnes()