weights n = w/2 : init ws ++ rs
   where w : ws = dct (map f [0..n'])
         rs = reverse (w/2 : ws)
         n' = bit (n-1) :: Int
         f k = 2/fromIntegral n'/(1 - 4 * fromIntegral k^2)
weights n = w/2 : init ws ++ rs
   where w : ws = dct (map f [0..n'])
         rs = reverse (w/2 : ws)
         n' = bit (n-1) :: Int
         f k = 2/fromIntegral n'/(1 - 4 * fromIntegral k^2)
weights n = w/2 : init ws ++ rs
   where w : ws = dct (map f [0..n'])
         rs = reverse (w/2 : ws)
         n' = bit (n-1) :: Int
         f k = 2/fromIntegral n'/(1 - 4 * fromIntegral k^2)