(N=15)
| 117 | |
| 118 | |
| 119 | def test_dct(N=15): |
| 120 | np.random.seed(12345) |
| 121 | |
| 122 | i = 0 |
| 123 | while i < N: |
| 124 | N = np.random.randint(2, 100) |
| 125 | signal = np.random.rand(N) |
| 126 | ortho = bool(np.random.randint(2)) |
| 127 | mine = DCT(signal, orthonormal=ortho) |
| 128 | theirs = dct(signal, norm="ortho" if ortho else None) |
| 129 | |
| 130 | np.testing.assert_almost_equal(mine, theirs) |
| 131 | print("PASSED") |
| 132 | i += 1 |
| 133 | |
| 134 | |
| 135 | def test_dft(N=15): |