Giter Club home page Giter Club logo

python-bit-vector's Introduction

python-bit-vector

A simple Python 3 wrapper for SDSL’s bit vectors and rank and select support.

Build Requirements

  • Python 3 (tested with version 3.6.5)
  • A C++ compiler (tested with Clang 6)
  • Cython (tested with version 0.29)

Usage Example

from bit_vector import BitVector

# Create a bit vector.
k = BitVector(5)
k[1] = True
k[3] = True

# Useful properties include rank_0, rank_1, select_0, select_1.
# Prepare the select_1 support.
k.select_1.prepare()

# Access the values. Currently, no bounds checking is performed.
for i in range(5):
	print(k[i])

print(k.select_1(1)) # Indices for rank and select are 1-based like in SDSL.
print(k.select_1(2))

python-bit-vector's People

Contributors

tsnorri avatar

Stargazers

Bill Katz avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.