From 8d11c6c8213f46f0fa19826917c255edd5d43cb1 Mon Sep 17 00:00:00 2001 From: mzuenni Date: Sun, 28 Jul 2024 22:54:40 +0200 Subject: Test (#4) * update * moved content in subdir * rename file * add test setup * add test setup * add github action * automaticly test all cpp files * timeout after 10s * setulimit and dont zero memory * test build pdf * install latexmk * update * update * ngerman * fonts * removed old code * add first test * added tests * test in sorted order * more tests * simplified test * more tests * fix suffix tree * fixes and improvements * done ust lst directly * fix swap * add links to pdf * fix constants * add primorial * add comment * various improvements * more tests * added missing stuf * more tests * fix tests * more tests * more tests * more tests * fix recursion? * test trie * more tests * only use python temporarily for listings * only use python temporarily for listings * more tests * fix longestCommonSubstring * more tests * more tests * made code more similiar * fix? * more tests * more tests * more tests * add ahoCorasick test + limit 4GB stack size * more tests * fix test * add additional test * more tests * more tests * fix? * better fix * fix virtual tree * more tests * more tests * recursive closest pair * more tests * decrease limit * new tests * more tests * fix name * more tests * add test * new test * more tests * more tests * more tests * more tests * new test and content * new code * new code * larger tests * fix and test * new test * new test * update pdf * remove comments * new test * more tests * more testcases * more tests * increased limit * more tests * more tests * more tests * new tests * more tests * shortened code * new test * add basic tests for bigint * more tests * removed old files * new test * ignore some files * more auto more ccw * fix test * more tests * fix * new tests * more tests * more tests * stronger test * actually verify delaunay... * more tests * fix header * more tests * run tests parallel? * test parralel? * add --missing * separate workflows * test * is the pdf checked? * separate workflows * fix workflow * more workflows --------- Co-authored-by: Yidi --- math/transforms/andTransform.cpp | 8 ----- math/transforms/bitwiseTransforms.cpp | 12 -------- math/transforms/fft.cpp | 23 -------------- math/transforms/fftMul.cpp | 14 --------- math/transforms/multiplyBitwise.cpp | 8 ----- math/transforms/multiplyFFT.cpp | 12 -------- math/transforms/multiplyNTT.cpp | 8 ----- math/transforms/ntt.cpp | 23 -------------- math/transforms/orTransform.cpp | 8 ----- math/transforms/seriesOperations.cpp | 56 ----------------------------------- math/transforms/xorTransform.cpp | 10 ------- 11 files changed, 182 deletions(-) delete mode 100644 math/transforms/andTransform.cpp delete mode 100644 math/transforms/bitwiseTransforms.cpp delete mode 100644 math/transforms/fft.cpp delete mode 100644 math/transforms/fftMul.cpp delete mode 100644 math/transforms/multiplyBitwise.cpp delete mode 100644 math/transforms/multiplyFFT.cpp delete mode 100644 math/transforms/multiplyNTT.cpp delete mode 100644 math/transforms/ntt.cpp delete mode 100644 math/transforms/orTransform.cpp delete mode 100644 math/transforms/seriesOperations.cpp delete mode 100644 math/transforms/xorTransform.cpp (limited to 'math/transforms') diff --git a/math/transforms/andTransform.cpp b/math/transforms/andTransform.cpp deleted file mode 100644 index 1fd9f5c..0000000 --- a/math/transforms/andTransform.cpp +++ /dev/null @@ -1,8 +0,0 @@ -void fft(vector& a, bool inv = false) { - int n = sz(a); - for (int s = 1; s < n; s *= 2) { - for (int i = 0; i < n; i += 2 * s) { - for (int j = i; j < i + s; j++) { - ll& u = a[j], &v = a[j + s]; - tie(u, v) = inv ? pair(v - u, u) : pair(v, u + v); -}}}} diff --git a/math/transforms/bitwiseTransforms.cpp b/math/transforms/bitwiseTransforms.cpp deleted file mode 100644 index 28561da..0000000 --- a/math/transforms/bitwiseTransforms.cpp +++ /dev/null @@ -1,12 +0,0 @@ -void bitwiseConv(vector& a, bool inv = false) { - int n = sz(a); - for (int s = 1; s < n; s *= 2) { - for (int i = 0; i < n; i += 2 * s) { - for (int j = i; j < i + s; j++) { - ll& u = a[j], &v = a[j + s]; - tie(u, v) = inv ? pair(v - u, u) : pair(v, u + v); // AND - //tie(u, v) = inv ? pair(v, u - v) : pair(u + v, u); //OR - //tie(u, v) = pair(u + v, u - v); // XOR - }}} - //if (inv) for (ll& x : a) x /= n; // XOR (careful with MOD) -} diff --git a/math/transforms/fft.cpp b/math/transforms/fft.cpp deleted file mode 100644 index 2bd95b2..0000000 --- a/math/transforms/fft.cpp +++ /dev/null @@ -1,23 +0,0 @@ -using cplx = complex; - -void fft(vector& a, bool inv = false) { - int n = sz(a); - for (int i = 0, j = 1; j < n - 1; ++j) { - for (int k = n >> 1; k > (i ^= k); k >>= 1); - if (j < i) swap(a[i], a[j]); - } - static vector ws(2, 1); - for (static int k = 2; k < n; k *= 2) { - ws.resize(n); - cplx w = polar(1.0, acos(-1.0) / k); - for (int i=k; i<2*k; i++) ws[i] = ws[i/2] * (i % 2 ? w : 1); - } - for (int s = 1; s < n; s *= 2) { - for (int j = 0; j < n; j += 2 * s) { - for (int k = 0; k < s; k++) { - cplx u = a[j + k], t = a[j + s + k]; - t *= (inv ? conj(ws[s + k]) : ws[s + k]); - a[j + k] = u + t; - a[j + s + k] = u - t; - if (inv) a[j + k] /= 2, a[j + s + k] /= 2; -}}}} diff --git a/math/transforms/fftMul.cpp b/math/transforms/fftMul.cpp deleted file mode 100644 index eac343c..0000000 --- a/math/transforms/fftMul.cpp +++ /dev/null @@ -1,14 +0,0 @@ -vector mul(vector& a, vector& b) { - vector c(sz(a)), d(sz(a)); - for (int i = 0; i < sz(b); i++) { - c[i] = {real(a[i]), real(b[i])}; - } - fft(c); - for (int i = 0; i < sz(b); i++) { - int j = (sz(a) - i) % sz(a); - cplx x = (c[i] + conj(c[j])) / cplx{2, 0}; //fft(a)[i]; - cplx y = (c[i] - conj(c[j])) / cplx{0, 2}; //fft(b)[i]; - d[i] = x * y; - } - return fft(d, true); -} diff --git a/math/transforms/multiplyBitwise.cpp b/math/transforms/multiplyBitwise.cpp deleted file mode 100644 index 0fa671c..0000000 --- a/math/transforms/multiplyBitwise.cpp +++ /dev/null @@ -1,8 +0,0 @@ -vector mul(vector a, vector b) { - int n = 1 << (__lg(max(sz(a), sz(b)) - 1) + 1); - a.resize(n), b.resize(n); - bitwiseConv(a), bitwiseConv(b); - for (int i=0; i mul(vector& a, vector& b) { - int n = 1 << (__lg(sz(a) + sz(b) - 1) + 1); - vector a2(all(a)), b2(all(b)); - a2.resize(n), b2.resize(n); - fft(a2), fft(b2); - for (int i=0; i ans(n); - for (int i=0; i mul(vector a, vector b) { - int n = 1 << (__lg(sz(a) + sz(b) - 1) + 1); - a.resize(n), b.resize(n); - ntt(a), ntt(b); - for (int i=0; i& a, bool inv = false) { - int n = sz(a); - auto b = a; - ll r = inv ? powMod(root, mod - 2, mod) : root; - - for (int s = n / 2; s > 0; s /= 2) { - ll ws = powMod(r, (mod - 1) / (n / s), mod), w = 1; - for (int j = 0; j < n / 2; j += s) { - for (int k = j; k < j + s; k++) { - ll u = a[j + k], t = a[j + s + k] * w % mod; - b[k] = (u + t) % mod; - b[n/2 + k] = (u - t + mod) % mod; - } - w = w * ws % mod; - } - swap(a, b); - } - if (inv) { - ll div = powMod(n, mod - 2, mod); - for (auto& x : a) x = x * div % mod; -}} diff --git a/math/transforms/orTransform.cpp b/math/transforms/orTransform.cpp deleted file mode 100644 index eb1da44..0000000 --- a/math/transforms/orTransform.cpp +++ /dev/null @@ -1,8 +0,0 @@ -void fft(vector& a, bool inv = false) { - int n = sz(a); - for (int s = 1; s < n; s *= 2) { - for (int i = 0; i < n; i += 2 * s) { - for (int j = i; j < i + s; j++) { - ll& u = a[j], &v = a[j + s]; - tie(u, v) = inv ? pair(v, u - v) : pair(u + v, u); -}}}} diff --git a/math/transforms/seriesOperations.cpp b/math/transforms/seriesOperations.cpp deleted file mode 100644 index 4743674..0000000 --- a/math/transforms/seriesOperations.cpp +++ /dev/null @@ -1,56 +0,0 @@ -vector poly_inv(const vector& a, int n) { - vector q = {powMod(a[0], mod-2, mod)}; - for (int len = 1; len < n; len *= 2){ - vector a2 = a, q2 = q; - a2.resize(2*len), q2.resize(2*len); - ntt(q2); - for (int j : {0, 1}) { - ntt(a2); - for (int i = 0; i < 2*len; i++) a2[i] = a2[i]*q2[i] % mod; - ntt(a2, true); - for (int i = 0; i < len; i++) a2[i] = 0; - } - for (int i = len; i < min(n, 2*len); i++) { - q.push_back((mod - a2[i]) % mod); - }} - return q; -} - -vector poly_deriv(vector a) { - for (int i = 1; i < sz(a); i++) - a[i-1] = a[i] * i % mod; - a.pop_back(); - return a; -} - -vector poly_integr(vector a) { - if (a.empty()) return {0}; - a.push_back(a.back() * powMod(sz(a), mod-2, mod) % mod); - for (int i = sz(a)-2; i > 0; i--) - a[i] = a[i-1] * powMod(i, mod-2, mod) % mod; - a[0] = 0; - return a; -} - -vector poly_log(vector a, int n) { - a = mul(poly_deriv(a), poly_inv(a, n)); - a.resize(n-1); - a = poly_integr(a); - return a; -} - -vector poly_exp(vector a, int n) { - vector q = {1}; - for (int len = 1; len < n; len *= 2) { - vector p = poly_log(q, 2*len); - for (int i = 0; i < 2*len; i++) - p[i] = (mod - p[i] + (i < sz(a) ? a[i] : 0)) % mod; - vector q2 = q; - q2.resize(2*len); - ntt(p), ntt(q2); - for (int i = 0; i < 2*len; i++) p[i] = p[i] * q2[i] % mod; - ntt(p, true); - for (int i = len; i < min(n, 2*len); i++) q.push_back(p[i]); - } - return q; -} diff --git a/math/transforms/xorTransform.cpp b/math/transforms/xorTransform.cpp deleted file mode 100644 index f9d1d82..0000000 --- a/math/transforms/xorTransform.cpp +++ /dev/null @@ -1,10 +0,0 @@ -void fft(vector& a, bool inv = false) { - int n = sz(a); - for (int s = 1; s < n; s *= 2) { - for (int i = 0; i < n; i += 2 * s) { - for (int j = i; j < i + s; j++) { - ll& u = a[j], &v = a[j + s]; - tie(u, v) = pair(u + v, u - v); - }}} - if (inv) for (ll& x : a) x /= n; -} -- cgit v1.2.3