Git Product home page Git Product logo

intbitset's Introduction

intbitset

image

image

image

image

image

Installation

intbitset is on PyPI so all you need is a C compiler and pip: :

pip install intbitset

Documentation

The intbitset library provides a set implementation to store sorted unsigned integers either 32-bits integers (between 0 and 2**31 - 1 or intbitset.__maxelem__) or an infinite range with fast set operations implemented via bit vectors in a Python C extension for speed and reduced memory usage.

The inbitset class emulates the Python built-in set class interface with some additional specific methods such as its own fast dump and load marshalling functions. :

>>> from intbitset import intbitset
>>> x = intbitset([1,2,3])
>>> y = intbitset([3,4,5])
>>> x & y
intbitset([3])
>>> x | y
intbitset([1, 2, 3, 4, 5])

intbitset additionally support the pickle protocol, the iterator protocol and can behave like a sequence that can be sliced. Because the intergers are always stored sorted, the fist element of a non-empty set [0] is also the min() integer and the last element [-1] is also the max() integer in the set.

When compared to the standard library set class, intbitset set operations such as intersection, union and difference can be up to 5000 faster for dense integer sets.

Complete documentation is available at <http://intbitset.readthedocs.io> or can be built using Sphinx: :

pip install Sphinx
python setup.py build_sphinx

Testing

Running the tests are as simple as: :

python setup.py test

Running the tests on multiple Python versions: :

pip install tox
tox

Development

To regenerate the C code with Cython: :

pip install cython
cython intbitset/intbitset.pyx

Then commit the regenarted C source and update the CHANGE.rst

License

Copyright (C) CERN and others

SPDX-License-Indetifier: LGPL-3.0-or-later

intbitset is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

intbitset is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with intbitset; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

In applying this licence, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction.

intbitset's People

Contributors

kaplun avatar tiborsimko avatar pombredanne avatar jirikuncar avatar mundya avatar max-te avatar lnielsen avatar maxyz avatar osso avatar crepererum avatar pombreda avatar tardyp avatar steven-esser avatar greut avatar

Watchers

James Cloos 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.