Skip to content

Commit

Permalink
Revert "Merge branch 'feature/circleci' into feature/circleci"
Browse files Browse the repository at this point in the history
This reverts commit ee4768f, reversing
changes made to 50fd599.
  • Loading branch information
ivigns committed Mar 3, 2019
1 parent ee4768f commit e68d0fc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 56 deletions.
7 changes: 0 additions & 7 deletions pysdsl/types/int_vectors.h

This file was deleted.

97 changes: 48 additions & 49 deletions pysdsl/types/intvector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,15 @@ inline auto add_int_class(py::module& m, py::dict& dict, KEY_T key,
return cls;
}

template <typename VectorT>
auto add_int_vector(py::module& m, py::dict& int_vectors_dict) {
size_t width = VectorT::fixed_int_width;
std::string name = "Int" + std::to_string(width) + "Vector";
return add_int_class<VectorT, typename VectorT::value_type>(
m, int_vectors_dict, width, name.c_str())
.def(py::init(
[width](size_t size, typename VectorT::value_type default_value) {
return VectorT(size, default_value, width); }),
py::arg("size") = 0, py::arg("default_value") = 0);
}

template<>
auto add_int_vector<sdsl::int_vector<0>>(py::module& m, py::dict& int_vectors_dict) {
return add_int_class<sdsl::int_vector<0>>(
inline auto add_int_vectors(py::module& m)
{
py::dict int_vectors_dict;

m.attr("int_vector") = int_vectors_dict;

return std::make_tuple(
add_int_class<sdsl::int_vector<0>>(
m, int_vectors_dict, "dynamic", "IntVector", doc_int_vector)
.def(
py::init([](size_t size,
Expand All @@ -204,54 +198,59 @@ auto add_int_vector<sdsl::int_vector<0>>(py::module& m, py::dict& int_vectors_di
[](sdsl::int_vector<0> &self) {
sdsl::util::bit_compress(self); },
doc_bit_compress,
py::call_guard<py::gil_scoped_release>());
}
py::call_guard<py::gil_scoped_release>()),

template <>
auto add_int_vector<sdsl::int_vector<1>>(py::module& m, py::dict& int_vectors_dict) {
return add_int_class<sdsl::int_vector<1>, bool>(
add_int_class<sdsl::int_vector<1>, bool>(
m, int_vectors_dict, 1ul , "BitVector")
.def(py::init(
[](size_t size, bool default_value) {
return sdsl::int_vector<1>(size, default_value, 1); }),
py::arg("size") = 0, py::arg("default_value") = false)
.def("flip", &sdsl::int_vector<1>::flip,
"Flip all bits of bit_vector",
py::call_guard<py::gil_scoped_release>());
}
py::call_guard<py::gil_scoped_release>()),

add_int_class<sdsl::int_vector<4>, uint16_t>(
m, int_vectors_dict, 4, "Int4Vector")
.def(py::init(
[](size_t size, uint8_t default_value) {
return sdsl::int_vector<4>(size, default_value, 4); }),
py::arg("size") = 0, py::arg("default_value") = 0),

template <typename... VectorT>
auto make_int_vectors(py::module& m, py::dict& int_vectors_dict) {
return std::make_tuple(add_int_vector<VectorT>(m, int_vectors_dict)...);
}
add_int_class<sdsl::int_vector<8>, uint16_t>(
m, int_vectors_dict, 8, "Int8Vector")
.def(py::init(
[](size_t size, uint8_t default_value) {
return sdsl::int_vector<8>(size, default_value, 8); }),
py::arg("size") = 0, py::arg("default_value") = 0),

add_int_class<sdsl::int_vector<16>, uint16_t>(
m, int_vectors_dict, 16, "Int16Vector")
.def(py::init(
[](size_t size, uint16_t default_value) {
return sdsl::int_vector<16>(size, default_value, 16); }),
py::arg("size") = 0, py::arg("default_value") = 0),

inline auto add_int_vectors(py::module& m)
{
py::dict int_vectors_dict;
add_int_class<sdsl::int_vector<24>, uint32_t>(
m, int_vectors_dict, 24, "Int24Vector")
.def(py::init(
[](size_t size, uint32_t default_value) {
return sdsl::int_vector<24>(size, default_value, 24); }),
py::arg("size") = 0, py::arg("default_value") = 0),

m.attr("int_vector") = int_vectors_dict;
add_int_class<sdsl::int_vector<32>, uint32_t>(
m, int_vectors_dict, 32, "Int32Vector")
.def(py::init(
[](size_t size, uint32_t default_value) {
return sdsl::int_vector<32>(size, default_value, 32); }),
py::arg("size") = 0, py::arg("default_value") = 0),

return make_int_vectors<sdsl::int_vector<0>,
sdsl::int_vector<1>,
sdsl::int_vector<4>,
sdsl::int_vector<8>,
sdsl::int_vector<16>,
sdsl::int_vector<24>,
sdsl::int_vector<32>,
sdsl::int_vector<48>,
sdsl::int_vector<64>>(m, int_vectors_dict);

// #define DEF_INC_VECTOR(width, value_type) ,\
// add_int_class<sdsl::int_vector<width>, value_type>( \
// m, int_vectors_dict, width, "Int" #width "Vector") \
// .def(py::init( \
// [](size_t size, value_type default_value) { \
// return sdsl::int_vector<width>(size, default_value, width); }), \
// py::arg("size") = 0, py::arg("default_value") = 0)
// #include "int_vectors.h"
// #undef DEF_INC_VECTOR
// );
add_int_class<sdsl::int_vector<64>, uint64_t>(
m, int_vectors_dict, 64, "Int64Vector")
.def(py::init(
[](size_t size, uint64_t default_value) {
return sdsl::int_vector<64>(size, default_value, 64); }),
py::arg("size") = 0, py::arg("default_value") = 0)
);

}

0 comments on commit e68d0fc

Please sign in to comment.