-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathberlekamp_massey.cpp
More file actions
51 lines (43 loc) · 890 Bytes
/
Copy pathberlekamp_massey.cpp
File metadata and controls
51 lines (43 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
vector<ll> operator+(vector<ll> a, vector<ll> b) {
vector<ll> c(max(a.size(), b.size()));
for (int i = 0; i < c.size(); i++) {
ll u = i < a.size() ? a[i] : 0;
ll v = i < b.size() ? b[i] : 0;
c[i] = u + v;
}
return c;
}
vector<ll> berlekamp_massey(vector<ll> s) {
int N = s.size();
vector<ll> C = {0, 1};
vector<ll> B = {0, 1};
int L = 0;
int m = 0;
ll b = 1;
for (int n = 0; n < N; n++) {
// calculate discrepancy
ll d = s[n];
for (int i = 1; i <= L && n - i >= 0; i++)
d += C[i] * s[n - i];
if (d == 0) {
m++
} else if (2 * L <= n) {
} else {
}
}
return C;
}
int main() {
vector<ll> a = {1, 2, 3};
vector<ll> b = {1, 2};
vector<ll> c = a + b;
for (ll x : c) cout << x << endl;
return 0;
}