I need to generate a Hadamard matrix with dimensions of $4096$, but it seems Mathematica is much slower than MATLAB when generating such matrices.
(MatrixPlot @ HadamardMatrix) // AbsoluteTiming
cost about 36 seconds on my computer to finish. While for MATLAB,
H = hadamard(4096); imshow(H)
cost about 0.7 seconds.
I tested the pure process of generating the
H matrix. The code is listed below.
Mathematica cost 20 seconds:
HadamardMatrix[4096, WorkingPrecision -> MachinePrecision] // AbsoluteTiming
MATLAB cost 0.12 second:
I was wondering if there is any method to increase the speed or efficiency of Mathematica on this problem?
Jim has provided a way of changing the Method:
HadamardMatrix[4096, Method -> "BitComplement"] // AbsoluteTiming HadamardMatrix[4096, Method -> "Sequency"] // AbsoluteTiming