Only import needed functions
# reference about classical DCT and DFT algorithms.
# reference about classical DCT and DFT algorithms.
-import math
-import cmath
-
-pi = math.pi
-sin = math.sin
-cos = math.cos
-sqrt = math.sqrt
+from random import random
+from math import pi, sin, cos, sqrt
+from cmath import exp
- return cmath.exp (alpha * 1j)
+ return exp (alpha * 1j)
def conjugate (c):
c = c + 0j
def conjugate (c):
c = c + 0j
str = str + realstr #+ imagstr
return "[%s]" % str
str = str + realstr #+ imagstr
return "[%s]" % str
def test(N):
input = vector(N)
output = vector(N)
verify = vector(N)
for i in range(N):
def test(N):
input = vector(N)
output = vector(N)
verify = vector(N)
for i in range(N):
- input[i] = whrandom.random() + 1j * whrandom.random()
+ input[i] = random() + 1j * random()
unscaled_DFT (N, input, output)
unscaled_DFT (N, input, verify)
unscaled_DFT (N, input, output)
unscaled_DFT (N, input, verify)