private static void TestFastDctLeeInvertibility() { for (int len = 1; len <= (1 << 22); len *= 2) { double[] vector = RandomVector(len); double[] temp = (double[])vector.Clone(); FastDctLee.Transform(temp); FastDctLee.InverseTransform(temp); for (int i = 0; i < temp.Length; i++) { temp[i] /= len / 2.0; } AssertArrayEquals(vector, temp, EPSILON); } }
/*---- Test suite ----*/ private static void TestFastDctLeeVsNaive() { for (int len = 1; len <= (1 << 13); len *= 2) { double[] vector = RandomVector(len); double[] expect = NaiveDct.Transform(vector); double[] actual = (double[])vector.Clone(); FastDctLee.Transform(actual); AssertArrayEquals(expect, actual, EPSILON); expect = NaiveDct.InverseTransform(vector); actual = (double[])vector.Clone(); FastDctLee.InverseTransform(actual); AssertArrayEquals(expect, actual, EPSILON); } }