function mergeRealAndImagArrays(real, imag) {
	  if (real.length !== imag.length) {
	    throw new Error("Cannot merge real and imag arrays of different lengths. real:" + (real.length + ", imag: " + imag.length + "."));
	  }

	  var result = new Float32Array(real.length * 2);

	  for (var i = 0; i < result.length; i += 2) {
	    result[i] = real[i / 2];
	    result[i + 1] = imag[i / 2];
	  }

	  return result;
	}
Merges real and imaginary Float32Arrays into a single complex Float32Array.

The memory layout is interleaved as follows:
real: [r0, r1, r2]
imag: [i0, i1, i2]
complex: [r0, i0, r1, i1, r2, i2]

This is the inverse of splitRealAndImagArrays.

@param real The real values of the complex tensor values.
@param imag The imag values of the complex tensor values.
@returns A complex tensor as a Float32Array with merged values.