forked from simongog/sdsl-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
233 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <iostream> | ||
#include <sdsl/vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
int_vector<> v = {3,2,1,0,2,1,3,4,1,1,1,3,2,3}; | ||
v[1] = 0; | ||
util::bit_compress(v); | ||
cout << v << endl; | ||
cout << size_in_bytes(v) << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <iostream> | ||
#include <sdsl/vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
int_vector<> v(10000000); | ||
for (size_t i=0; i<10; ++i) | ||
for (size_t j=0; j<1000000; ++j) | ||
v[i*1000000+j] = j; | ||
cout << size_in_mega_bytes(v) << endl; | ||
util::bit_compress(v); | ||
cout << size_in_mega_bytes(v) << endl; | ||
enc_vector<> ev(v); | ||
cout << size_in_mega_bytes(ev) << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <iostream> | ||
#include <sdsl/vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
int_vector<> v(10000000, 3); | ||
v[0] = 1ULL<<63; | ||
util::bit_compress(v); | ||
cout << size_in_mega_bytes(v) << endl; | ||
vlc_vector<> vv(v); | ||
cout << size_in_mega_bytes(vv) << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = {1,1,0,1,0,0,1}; | ||
cout << b << endl; | ||
b = bit_vector(80000000, 0); | ||
for (size_t i=0; i < b.size(); i+=100) | ||
b[i] = 1; | ||
cout << size_in_mega_bytes(b) << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = bit_vector(80000000, 0); | ||
for (size_t i=0; i < b.size(); i+=100) | ||
b[i] = 1; | ||
cout << size_in_mega_bytes(b) << endl; | ||
rrr_vector<63> rrrb(b); | ||
cout << size_in_mega_bytes(rrrb) << endl; | ||
sd_vector<> sdb(b); | ||
cout << size_in_mega_bytes(sdb) << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = bit_vector(80000000, 0); | ||
for (size_t i=0; i < b.size(); i+=100) | ||
b[i] = 1; | ||
sd_vector<> sdb(b); | ||
write_structure<JSON_FORMAT>(sdb, cout); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = bit_vector(8000, 0); | ||
for (size_t i=0; i < b.size(); i+=100) | ||
b[i] = 1; | ||
rank_support_v<1> b_rank(&b); | ||
for (size_t i=0; i<=b.size(); i+= b.size()/4) | ||
cout << "(" << i << ", " << b_rank(i) << ") "; | ||
cout << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = bit_vector(8000, 0); | ||
for (size_t i=0; i < b.size(); i+=100) | ||
b[i] = 1; | ||
sd_vector<> sdb(b); | ||
sd_vector<>::rank_1_type sdb_rank(&sdb); | ||
for (size_t i=0; i<=sdb.size(); i+= sdb.size()/4) | ||
cout << "(" << i << ", " << sdb_rank(i) << ") "; | ||
cout << endl; | ||
rrr_vector<> rrrb(b); | ||
rrr_vector<>::rank_1_type rrrb_rank(&rrrb); | ||
for (size_t i=0; i<=rrrb.size(); i+= rrrb.size()/4) | ||
cout << "(" << i << ", " << rrrb_rank(i) << ") "; | ||
cout << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = {0,1,0,1}; | ||
rank_support_v<1> b_r1(&b); | ||
rank_support_v<0> b_r0(&b); | ||
rank_support_v<10,2> b_r10(&b); | ||
rank_support_v<01,2> b_r01(&b); | ||
for (size_t i=0; i<=b.size(); ++i) | ||
cout << i << ": "<< b_r1(i) << " " << b_r0(i) | ||
<< " " << b_r10(i) << " " << b_r01(i) << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = {0,1,0,1,1,1,0,0,0,1,1}; | ||
size_t zeros = rank_support_v<0>(&b)(b.size()); | ||
bit_vector::select_0_type b_sel(&b); | ||
|
||
for (size_t i=1; i <= zeros; ++i) { | ||
cout << b_sel(i) << " "; | ||
} | ||
cout << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
bit_vector b = {0,1,0,1,1,1,0,0,0,1,1}; | ||
size_t cnt10 = rank_support_v<10,2>(&b)(b.size()); | ||
select_support_mcl<10,2> b_sel10(&b); | ||
|
||
for (size_t i=1; i <= cnt10; ++i) | ||
cout << b_sel10(i) << " "; | ||
cout << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <iostream> | ||
#include <sdsl/bit_vectors.hpp> | ||
#include <sdsl/vectors.hpp> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
sd_vector<> sd_b = bit_vector {1,0,1,1,1,0,1,1,0,0,1,0,0,1}; | ||
size_t ones = sd_vector<>::rank_1_type(&sd_b)(sd_b.size()); | ||
sd_vector<>::select_1_type sdb_sel(&sd_b); | ||
|
||
cout << sd_b << endl; | ||
|
||
for (size_t i=1; i <= ones; ++i) | ||
cout << sdb_sel(i) << " "; | ||
cout << endl; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <sdsl/wavelet_trees.hpp> | ||
#include <iostream> | ||
|
||
using namespace std; | ||
using namespace sdsl; | ||
|
||
int main() | ||
{ | ||
wt_blcd<> wt; | ||
construct(wt, "expl-13.cpp", 1); | ||
for (size_t i=0; i < wt.size() and wt[i]!='\n'; ++i) | ||
cout << wt[i]; | ||
cout << endl; | ||
cout << "number of lines : " << wt.rank(wt.size(), '\n') << endl; | ||
cout << "first '=' in line: " << wt.rank(wt.select(1, '='),'\n')+1 << endl; | ||
} |