Giter Site home page Giter Site logo

nixaraven / s9_vector Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 24 KB

Add-on for simongog/sdsl-lite that defines a new compressed bitvector called s9_vector

License: BSD 3-Clause "New" or "Revised" License

C++ 100.00%
sdsl succint-data-structure succinct-data-structure bitvector bit-vector

s9_vector's Introduction

s9_vector

Add-on for simongog/sdsl-lite that defines a new compressed bitvector called s9_vector

Implements a new type of compressed bit vector with support of rank1 and select1 operations. s9_vector is based on a previous implementation that was made with libcds in mind and adds new features such as block size as a template parameter, 64 bits support and several bug fixes.

Converts the input bit_vector into a compressed bitvector using gap encoding and then compresses the resulting integer vector using Simple 9 encoding for each block previously defined.

Usage

First install simongog/sdsl-lite as usual. Then include the new bitvector header that is in include/sdsl/s9_vector.hpp as it's shown in the next example:

#include <iostream>
#include <sdsl/int_vector.hpp>
#include <sdsl/rrr_vector.hpp>
#include <sdsl/sd_vector.hpp>
#include "s9_vector.hpp"

using namespace std;
using namespace sdsl;

int main(){
    bit_vector b = bit_vector(80*(1<<20),0);
    for (size_t i=0; i<b.size(); i+=100)
        b[i] = 1;
    cout << "Size in Bytes:\n" << endl;
    cout << "Original\t" << size_in_bytes(b) << endl;
   
    rrr_vector<63> rrrb(b);
    cout << "RRR\t\t" << size_in_bytes(rrrb) << endl;
    
    sd_vector<> sdb(b);
    cout << "SD\t\t" << size_in_bytes(sdb) << endl;

    s9_vector<> s9b(b);
    cout << "S9\t\t" << size_in_bytes(s9b) << endl;
    
    s9_vector<128, int_vector<32>> s9b32(b);
    cout << "S9(32)\t\t" << size_in_bytes(s9b32) << endl;

    return 0;
}

s9_vector's People

Contributors

nixaraven avatar

Forkers

darroyue

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.