Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fwht() input dimension #14

Closed
W-Wuxian opened this issue Mar 24, 2021 · 3 comments
Closed

fwht() input dimension #14

W-Wuxian opened this issue Mar 24, 2021 · 3 comments

Comments

@W-Wuxian
Copy link

From the README, we can use fwht(A) function for arbitrary A matrix with dimensions (n,m), but in fact both n and m have to be power of 2, right?

@stevengj
Copy link
Member

Yes.

@W-Wuxian
Copy link
Author

So could you add an internal function to deal with non-power of two dimensions?

@stevengj
Copy link
Member

stevengj commented Mar 27, 2021

The standard definition of the Walsh-Hadamard transform is only for power-of-two sizes. It can be extended to some other sizes, but the set of known sizes is somewhat limited (see also the hadamard function in this package), and the algorithms would become rapidly less efficient for larger factors. See also https://dsp.stackexchange.com/questions/7963/can-the-walsh-hadamard-transform-be-computed-for-non-power-of-2-sizes

For example, it would be possible to handle sizes of the form 2ⁿ(12)ᵐ(20)ᵏ with O[(n+m+k)log(n+m+k)] complexity, since we know Hadamard matrices of size 12 and 20, but they are dense 12x12 and 20x20 matrices so they would be handled much less efficiently than factors of 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants