Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xinychen authored Feb 4, 2023
1 parent 48816d7 commit 27b5982
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1280,3 +1280,21 @@ print(np.sum(np.abs(np.fft.fft(x)))
+ 0.5 * lmbda * np.linalg.norm(x - z, 2) ** 2)
print()
```

```python
def conv_mat(vec, kernel_size):
n = vec.shape[0]
mat = np.zeros((n, kernel_size))
mat[:, 0] = vec
for k in range(1, kernel_size):
mat[:, k] = np.append(vec[n - k :], vec[: n - k], axis = 0)
return mat

def inv_conv_mat(mat):
tau = mat.shape[1]
vec = mat[:, 0]
for k in range(1, tau):
vec += np.append(mat[k :, k], mat[: k, k], axis = 0)
return vec / tau
```

0 comments on commit 27b5982

Please sign in to comment.