semvec/pypi-packages huggingface dataset:
sparse-bit-arrays-jagprog5-TEST 0.0.11
sparse bit arrays
Requires Python: >=3.6

# Sparse Bit Arrays

A sparse bit array stores the indices of the bits that are ON for an arbitrarily lengthed array.

This package is a C lib wrapper.

## Overview

```python
from sba import *

# an array with the bits 0, 3, and 40 set to ON
b = SBA(0, 3, 40)

arr = b.to_np(deep_copy=True) # numpy array conversion

b.set_bit(3, False) # [0, 40]

# Makes a COPY of b, turn on bits 2 and 3, then places the result in c. b is NOT modified
c = b + [3, 2]

xored = a ^ b # equivalent to SBA.xor_bits(a, b)

# Randomly flips bits OFF, where each bit has an 80% chance of remaining ON
c *= 0.8

# encodes a float value by turning 3 bits ON in an array with the total size of 100
d = SBA.encode_linear(0,   3, 100) # [0, 1, 2]
d = SBA.encode_linear(0.5, 3, 100) # [49, 50, 51]
d = SBA.encode_linear(1.0, 3, 100) # [97, 98, 99]
```

## Installation

### Pip

The package is a source distribution, not a binary distribution. Windows users may need to do [this](https://docs.microsoft.com/en-us/answers/questions/136595/error-microsoft-visual-c-140-or-greater-is-require.html).


```diff
+pip install -i https://test.pypi.org/simple/ sparse-bit-arrays-jagprog5-TEST
-pip install sparse-bit-arrays <-- TODO
```
### GitHub
```bash
git clone https://github.com/jagprog5/sba.git
cd sba
make install
```
The installation can then be tested with:
```bash
make test
```