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

Add walsh(n) function that returns a Walsh matrix #28

Merged
merged 6 commits into from
Aug 30, 2024

Conversation

syoshida1983
Copy link
Contributor

I added a function walsh(n) that returns a Walsh matrix by bit-reversal permutation of a Hadamard matrix. The following package provides a similar function but merges it into Hadamard.jl would be helpful.
https://github.com/syoshida1983/Walsh.jl

src/Hadamard.jl Outdated Show resolved Hide resolved
src/Hadamard.jl Outdated Show resolved Hide resolved
src/Hadamard.jl Outdated Show resolved Hide resolved
src/Hadamard.jl Outdated Show resolved Hide resolved
@stevengj
Copy link
Member

stevengj commented Aug 28, 2024

Also needs some tests, e.g.

@testset "walsh(n)" begin
    @test walsh(8) == [1 1 1 1 1 1 1 1; 1 1 1 1 -1 -1 -1 -1; 1 1 -1 -1 -1 -1 1 1; 1 1 -1 -1 1 1 -1 -1; 1 -1 -1 1 1 -1 -1 1; 1 -1 -1 1 -1 1 1 -1; 1 -1 1 -1 -1 1 -1 1; 1 -1 1 -1 1 -1 1 -1]
    @test_throws ArgumentError walsh(24)
    for n in 2 .^ (0:10)
        @test fwht(Matrix(I(n)), 1) * n  walsh(n) rtol=1e-13
    end
end

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.84%. Comparing base (047c8fc) to head (ddbb690).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/Hadamard.jl 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   78.23%   78.84%   +0.61%     
==========================================
  Files           1        1              
  Lines         147      156       +9     
==========================================
+ Hits          115      123       +8     
- Misses         32       33       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@syoshida1983
Copy link
Contributor Author

Thank you for your review. I have incorporated the suggested changes and tests into the code and verified that the tests passed.

@stevengj
Copy link
Member

You should also add a note about the walsh(n) function to the README, in the section at the end about Hadamard matrices.

@syoshida1983
Copy link
Contributor Author

I updated README.md.

README.md Show resolved Hide resolved
@stevengj stevengj merged commit 69f8520 into JuliaMath:master Aug 30, 2024
3 checks passed
@syoshida1983 syoshida1983 deleted the dev branch September 1, 2024 12:55
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

Successfully merging this pull request may close these issues.

2 participants