private static void testConvolution(int size)
{
double[] randomReals1 = randomReals(size);
double[] randomReals2 = randomReals(size);
double[] randomReals3 = randomReals(size);
double[] randomReals4 = randomReals(size);
// Test double array overloads
double[] input0real = (double[])randomReals1.Clone();
double[] input0imag = (double[])randomReals2.Clone();
double[] input1real = (double[])randomReals3.Clone();
double[] input1imag = (double[])randomReals4.Clone();
double[] refoutreal = new double[size];
double[] refoutimag = new double[size];
naiveConvolve(input0real, input0imag, input1real, input1imag, refoutreal, refoutimag);
double[] actualoutreal = new double[size];
double[] actualoutimag = new double[size];
FourierTransform2.Convolve(input0real, input0imag, input1real, input1imag, actualoutreal, actualoutimag);
double error = log10RmsErr(refoutreal, refoutimag, actualoutreal, actualoutimag);
Assert.IsTrue(error < 13);
// Test Complex overloads
input0real = (double[])randomReals1.Clone();
input0imag = (double[])randomReals2.Clone();
input1real = (double[])randomReals3.Clone();
input1imag = (double[])randomReals4.Clone();
Complex[] input0 = input0real.ToComplex(input0imag);
Complex[] input1 = input1real.ToComplex(input1imag);
Complex[] actualout = new Complex[size];
FourierTransform2.Convolve(input0, input1, actualout);
actualoutreal = actualout.Re();
actualoutimag = actualout.Im();
double newError = log10RmsErr(refoutreal, refoutimag, actualoutreal, actualoutimag);
Assert.AreEqual(error, newError);
}