Commit 222f800a authored by Rafaël Carré's avatar Rafaël Carré

doc/transforms.py: whrandom is deprecated since python 2.1

Only import needed functions
parent edeb8f7b
...@@ -3,16 +3,12 @@ ...@@ -3,16 +3,12 @@
# reference about classical DCT and DFT algorithms. # reference about classical DCT and DFT algorithms.
import math from random import random
import cmath from math import pi, sin, cos, sqrt
from cmath import exp
pi = math.pi
sin = math.sin
cos = math.cos
sqrt = math.sqrt
def exp_j (alpha): def exp_j (alpha):
return cmath.exp (alpha * 1j) return exp (alpha * 1j)
def conjugate (c): def conjugate (c):
c = c + 0j c = c + 0j
...@@ -1067,15 +1063,13 @@ def dump (vector): ...@@ -1067,15 +1063,13 @@ def dump (vector):
str = str + realstr #+ imagstr str = str + realstr #+ imagstr
return "[%s]" % str return "[%s]" % str
import whrandom
def test(N): def test(N):
input = vector(N) input = vector(N)
output = vector(N) output = vector(N)
verify = vector(N) verify = vector(N)
for i in range(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, output)
unscaled_DFT (N, input, verify) unscaled_DFT (N, input, verify)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment