Go to the documentation of this file.
64 for (
size_t j = 1; j <=
Size; j++)
Tree[pos(j)] = sequence[j - 1];
66 for (
size_t m = 2; m <=
Size; m <<= 1) {
67 for (
size_t idx = m; idx <=
Size; idx += m)
Tree[pos(idx)] +=
Tree[pos(idx - m / 2)];
71 virtual uint64_t
prefix(
size_t idx) {
75 sum +=
Tree[pos(idx)];
82 virtual void add(
size_t idx, int64_t inc) {
84 Tree[pos(idx)] += inc;
90 virtual size_t find(uint64_t *val) {
94 if (node + m >
Size)
continue;
96 uint64_t value =
Tree[pos(node + m)];
112 if (node + m >
Size)
continue;
114 uint64_t value = (BOUND <<
rho(node + m)) -
Tree[pos(node + m)];
125 virtual void push(uint64_t val) {
126 size_t p = pos(++
Size);
130 if ((
Size & 1) == 0) {
156 static inline size_t holes(
size_t idx) {
return idx >> 14; }
158 static inline size_t pos(
size_t idx) {
return idx + holes(idx); }
161 os.write((
char *)&ft.
Size,
sizeof(uint64_t));
162 return os << ft.
Tree;
166 is.read((
char *)&ft.
Size,
sizeof(uint64_t));
167 return is >> ft.
Tree;
virtual void reserve(size_t space)
Definition: FenwickFixedF.hpp:142
int rho(uint64_t word)
Definition: common.hpp:168
Definition: Expandable.hpp:37
virtual size_t size() const
Definition: FenwickFixedF.hpp:151
void trimToFit()
Definition: Expandable.hpp:93
Definition: Expandable.hpp:43
FenwickFixedF()
Definition: FenwickFixedF.hpp:53
virtual void trim(size_t space)
Definition: FenwickFixedF.hpp:145
virtual size_t find(uint64_t *val)=0
virtual size_t bitCount() const
Definition: FenwickFixedF.hpp:153
uint64_t mask_lambda(uint64_t word)
Definition: common.hpp:216
Definition: FenwickFixedF.hpp:42
virtual void resize(size_t space)
Definition: FenwickFixedF.hpp:147
virtual void grow(size_t space)
Definition: FenwickFixedF.hpp:140
virtual size_t compFind(uint64_t *val)
Definition: FenwickFixedF.hpp:108
virtual size_t find(uint64_t *val)
Definition: FenwickFixedF.hpp:90
void reserve(size_t capacity)
Definition: Vector.hpp:141
virtual uint64_t prefix(size_t idx)
Definition: FenwickFixedF.hpp:71
void size(size_t size)
Definition: Vector.hpp:178
friend std::istream & operator>>(std::istream &is, FenwickFixedF< BOUND, AT > &ft)
Definition: FenwickFixedF.hpp:165
void grow(size_t capacity)
Definition: Vector.hpp:153
virtual void add(size_t idx, int64_t inc)
Definition: FenwickFixedF.hpp:82
Vector< uint64_t, AT > Tree
Definition: FenwickFixedF.hpp:45
virtual void push(uint64_t val)
Definition: FenwickFixedF.hpp:125
constexpr size_t ceil_log2_plus1(size_t n)
Definition: common.hpp:100
size_t bitCount() const
Definition: Vector.hpp:231
static constexpr size_t BOUNDSIZE
Definition: FenwickFixedF.hpp:44
uint64_t clear_rho(uint64_t word)
Definition: common.hpp:194
Definition: SearchablePrefixSums.hpp:53
size_t Size
Definition: FenwickFixedF.hpp:49
virtual void pop()
Definition: FenwickFixedF.hpp:135
void resize(size_t size)
Definition: Vector.hpp:166
virtual void size(size_t space)
Definition: FenwickFixedF.hpp:149
friend std::ostream & operator<<(std::ostream &os, const FenwickFixedF< BOUND, AT > &ft)
Definition: FenwickFixedF.hpp:160
FenwickFixedF(uint64_t sequence[], size_t size)
Definition: FenwickFixedF.hpp:63
uint64_t mask_rho(uint64_t word)
Definition: common.hpp:208
void trim(size_t capacity)
Definition: Vector.hpp:127
T popBack()
Definition: Vector.hpp:200
virtual size_t compFind(uint64_t *val)=0