Skip to content

Commit 8c0af3f

Browse files
committed
first draft of walk for xor basis
1 parent d776b1c commit 8c0af3f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/math/matrix_related/xor_basis_ordered.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,14 @@ template<class T> struct basis_ordered {
2525
int i = shrink(v);
2626
return i >= 0 ? b[i] = v, ++siz : 0;
2727
}
28+
T walk(T k) {
29+
T res{};
30+
for (int i = lg - 1, j = siz - 1; i >= 0; i--)
31+
if (b[i] != T(0)) {
32+
if ((((res >> i) ^ (k >> j)) & T(1)) != T(0))
33+
res ^= b[i];
34+
j--;
35+
}
36+
return res;
37+
}
2838
};

0 commit comments

Comments
 (0)