Skip to content

Commit

Permalink
fix hadamard.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
hitonanode committed Sep 22, 2024
1 parent 6647676 commit a8c8b58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions convolution/hadamard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ template <typename T, typename F> void abstract_fwht(std::vector<T> &seq, F f) {
assert(__builtin_popcount(n) == 1);
for (int w = 1; w < n; w *= 2) {
for (int i = 0; i < n; i += w * 2) {
for (int j = 0; j < w; j++) { f(seq[i + j], seq[i + j + w]); }
for (int j = 0; j < w; j++) f(seq.at(i + j), seq.at(i + j + w));
}
}
}
Expand All @@ -25,7 +25,7 @@ std::vector<T> bitwise_conv(std::vector<T> x, std::vector<T> y, F1 f, F2 finv) {
} else {
abstract_fwht(x, f), abstract_fwht(y, f);
}
for (size_t i = 0; i < x.size(); i++) { x[i] *= y[i]; }
for (int i = 0; i < (int)x.size(); i++) x.at(i) *= y.at(i);
abstract_fwht(x, finv);
return x;
}
Expand Down

0 comments on commit a8c8b58

Please sign in to comment.