juliamath / hadamard.jl Goto Github PK
View Code? Open in Web Editor NEWFast Walsh-Hadamard transforms for the Julia language
License: MIT License
Fast Walsh-Hadamard transforms for the Julia language
License: MIT License
the usual seems so much faster
function had(n) begin
z=1
for i=1:log2(n)
z= kron(z,[1 1;1 -1])
end
end
z
end
n=1024
@time hadamard(n);
@time had(n);
elapsed time: 0.026615681 seconds (16779744 bytes allocated)
elapsed time: 0.006890752 seconds (11186592 bytes allocated)
While on the subject of hadamard(n), it would be nice if a matrix would
come for n=1,2 and every multiple of 4 , say up to 1000, times a power of 2
(except of course 668 and such)
Hey there, I noticed this precompile error. I attempted to rebuild and got the same error. I think this may be a result of an API change.
[ Info: Precompiling Hadamard [4a05ff16-5f95-55f4-bb53-bb3f467c689a]
ERROR: LoadError: MethodError: no method matching occursin(::String, ::Base.RefValue{String})
Closest candidates are:
occursin(::Union{AbstractChar, AbstractString}, ::AbstractString) at strings/search.jl:621
occursin(::Any) at strings/search.jl:635
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/Hadamard/3fngh/src/Hadamard.jl:65
[2] include
@ ./Base.jl:386 [inlined]
[3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base ./loading.jl:1213
[4] top-level scope
@ none:1
[5] eval
@ ./boot.jl:360 [inlined]
[6] eval(x::Expr)
@ Base.MainInclude ./client.jl:446
[7] top-level scope
@ none:1
in expression starting at /home/xxx/.julia/packages/Hadamard/3fngh/src/Hadamard.jl:6
ERROR: Failed to precompile Hadamard [4a05ff16-5f95-55f4-bb53-bb3f467c689a] to /home/xxx/.julia/compiled/v1.6/Hadamard/jl_FbfP53.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
@ Base ./loading.jl:1360
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1306
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1021
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:914
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:901
versioninfo() output:
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
##### Current package: Hadamard
INFO: Cloning cache of Hadamard from git://github.com/stevengj/Hadamard.jl.git
INFO: Installing Hadamard v0.0.0
INFO: REQUIRE updated.
WARNING: max(x) is deprecated, use maximum(x) instead.
in depwarn at deprecated.jl:29
in max at deprecated.jl:19
in ifwht at /home/idunning/pkgtest/.julia/v0.2/Hadamard/src/Hadamard.jl:145
in include at boot.jl:238
WARNING: max(x) is deprecated, use maximum(x) instead.
in depwarn at deprecated.jl:29
in max at deprecated.jl:19
in ifwht at /home/idunning/pkgtest/.julia/v0.2/Hadamard/src/Hadamard.jl:145
in ifwht at /home/idunning/pkgtest/.julia/v0.2/Hadamard/src/Hadamard.jl:187
in include at boot.jl:238
WARNING: max(x) is deprecated, use maximum(x) instead.
in depwarn at deprecated.jl:29
in max at deprecated.jl:19
in ifwht at /home/idunning/pkgtest/.julia/v0.2/Hadamard/src/Hadamard.jl:145
in fwht at /home/idunning/pkgtest/.julia/v0.2/Hadamard/src/Hadamard.jl:198
in anonymous at no file:90
in include at boot.jl:238
WARNING: max(x) is deprecated, use maximum(x) instead.
in depwarn at deprecated.jl:29
in max at deprecated.jl:19
in norminf at /home/idunning/pkgtest/.julia/v0.2/Hadamard/test/hadamard.jl:86
in anonymous at no file:90
in include at boot.jl:238
INFO: Removing Hadamard v0.0.0
INFO: REQUIRE updated.
Hi, and thanks for the package.
I think it would be nice to have an in place version of the different functions.
I am not sure to understand how the FFTW library can handle that, but I guess it does somehow. Maybe it's even possible to call the library with Y=X, in which case it would just be a matter of writing a few wrappers ? Or is there something more complex that would make it difficult ?
hadamard(12)
and hadamard(100)
are both supported, but hadamard(1200)
gives an error.
The problem is the order in which we look for factors: finds the factor of 120 first (the biggest factor for which we have a tabulated Hadamard matrix), but what is left is then a factor of 10 (which does not have a Hadamard matrix because it is not a multiple of 4).
We should probably search all factors of sizes 4*odd
first.
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?
The https://github.com/FALCONN-LIB/FFHT repository implements a specialized SIMD FHT, which it says is faster than FFTW for this problem. (Totally possible, since 2×2×2×⋯ multidimensional transforms are not that optimized in FFTW — they are using size-2 DFT kernels, whereas to be fast they should really use larger multidimensional kernels.) Might be interesting to support using FFHT (which is MIT-licensed) in cases where it is applicable.
After the Julia DFT API updates in JuliaLang/julia#12201, this module needs significant changes to work with 0.4. (It is probably best to just fork a new 0.4 version.)
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.