In Python, dct()
in scipy is similar to dct2()
in matlab, so is there a library similar to dctmtx in matlab in Python?
To get the same result as D = dctmtx(n)
in Matlab, you can use
D = dct(np.eye(n), norm='ortho', axis=0)
Paul Panzer's suggestion should also work fine, and might even be a bit faster.