Skip to content

Commit

Permalink
compatible with .6
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentcp committed Jul 17, 2018
1 parent 40584ee commit 11816db
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: julia
os:
- linux
- osx
julia:
- 0.6
before_install:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
script:
- julia -e 'Pkg.clone(pwd())'
- julia -e 'Pkg.build("WaveletsCopy")'
- julia --check-bounds=yes -e 'Pkg.test("WaveletsCopy", coverage=true)'
- nightly
- 0.6
notifications:
email: false
after_success:
- julia -e 'cd(Pkg.dir("WaveletsCopy")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())'
- julia -e 'cd(Pkg.dir("WaveletsCopy")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())'
4 changes: 4 additions & 0 deletions src/dwt/discretewavelets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ module DWT
if VERSION > v"0.7-"
using LinearAlgebra
linspace(a,b,c) = range(a, stop=b, length=c)
else
ComplexF64 = Complex128
rmul! = scale!
copyto! = copy!
end

using ..Sequences
Expand Down
2 changes: 1 addition & 1 deletion src/dwt/scaling_coefficients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ scaling_coefficients(f::AbstractArray, s::Side, w::DiscreteWavelet{T}, bnd::Peri
# function samples to scaling coeffients
function scaling_coefficients(f::AbstractArray, filter::CompactSequence{T}, fembedding; n::Int=length(f), options...) where {T}
@assert isdyadic(f)
c = Array{T}(undef, n)
c = (VERSION<v"0.7-") ? Array{T}(n) : Array{T}(undef, n)
scaling_coefficients!(c, f, filter, fembedding; options...)
c
end
Expand Down
3 changes: 2 additions & 1 deletion src/dwt/util/scratchspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ get_scratch_space(SS::ScratchSpace, lengths) =
function _get_indices(lengths::Vector{Int}, input)
L = length(lengths)
LL = length(input)
r = Array{Int}(undef, LL)

r = (VERSION<v"0.7-") ? Array{Int}(LL) : Array{Int}(undef, LL)
@inbounds for i in 1:LL
s = input[i]
for j in 1:L
Expand Down
4 changes: 2 additions & 2 deletions src/dwt/wvlt_daubechies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ vanishingmoments(::Dul, ::Type{DaubechiesWavelet{N,T}}) where {N,T} = N
function daubechies(N::Int)
@assert N > 0
# Create polynomial
C = Array{Int}(undef, N)
C = (VERSION<v"0.7-") ? Array{Int}(N) : Array{Int}(undef, N)
@inbounds for n = 0:N-1
C[N-n] = binomial(N-1+n, n)
end
Expand Down Expand Up @@ -85,7 +85,7 @@ function daubechies(N::Int)

# Find coefficients of the polynomial
# (1 + z)^N * \prod_i (z - z_i)
R = Array{ComplexF64}(undef, N+nr)
R = (VERSION<v"0.7-") ? Array{ComplexF64}(N+nr) : Array{ComplexF64}(undef, N+nr)
@inbounds for i = 1:N
R[i] = -1
end
Expand Down
7 changes: 5 additions & 2 deletions src/filterbanks/filterbank.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ PolyphaseMatrix = FilterMatrix
eltype(::Type{FilterMatrix{F11,F12,F21,F22}}) where {F11,F12,F21,F22} = eltype(F11)

transpose(m::FilterMatrix) = FilterMatrix(m.a11, m.a21, m.a12, m.a22)

adjoint(m::FilterMatrix) = FilterMatrix(m.a11', m.a21', m.a12', m.a22')
if (VERSION > v"0.7-")
adjoint(m::FilterMatrix) = FilterMatrix(m.a11', m.a21', m.a12', m.a22')
else
ctranspose(m::FilterMatrix) = FilterMatrix(m.a11', m.a21', m.a12', m.a22')
end

# Done removed: call(m::FilterMatrix, z) = [ztransform(m.a11, z) ztransform(m.a12, z); ztransform(m.a21, z) ztransform(m.a22, z)]
(m::FilterMatrix)(z) = [ztransform(m.a11, z) ztransform(m.a12, z); ztransform(m.a21, z) ztransform(m.a22, z)]
Expand Down
5 changes: 4 additions & 1 deletion src/sequences/compactsequences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ shift(s::FixedSequence{L,OFS,T}, k::Int) where {L,OFS,T} = FixedSequence(s.a, Va


hascompactsupport(::Type{FixedSequence{L,OFS,T}}) where {L,OFS,T}= True
fs = (VERSION > v"0.7-") ?
(:adjoint, :evenpart, :oddpart, :alternating_flip, :reverse, :conj, :alternating) :
(:ctranspose, :evenpart, :oddpart, :alternating_flip, :reverse, :conj, :alternating)

for op in (:adjoint, :evenpart, :oddpart, :alternating_flip, :reverse, :conj, :alternating)
for op in fs
@eval $op(s::FixedSequence{L,OFS,T}) where {L,OFS,T} = FixedSequence($op(CompactSequence{T}(s)))
end
10 changes: 5 additions & 5 deletions test/suite_evaluation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,13 @@ function implementation_test()
DWT.evaluate_periodic_in_dyadic_points(Dual, DWT.wavelet, DWT.cdf11))<1e-14


@test evaluate_periodic_in_dyadic_points(Dual, scaling, DWT.db1, 0,0,2,points=true)[2] == linspace(0,1,5)[1:end-1]
@test evaluate_periodic_in_dyadic_points(Dual, DWT.wavelet, DWT.db1, 0,0,2,points=true)[2] == linspace(0,1,5)[1:end-1]
@test evaluate_in_dyadic_points(Dual, DWT.wavelet, DWT.db1, 0,0,2,points=true)[2]==linspace(0,1,5)
@test evaluate_in_dyadic_points(Dual, DWT.wavelet, DWT.cdf24, 0,0,2,points=true)[2]==linspace(-2,3,21)
@test collect(evaluate_periodic_in_dyadic_points(Dual, scaling, DWT.db1, 0,0,2,points=true)[2]) == collect(linspace(0,1,5)[1:end-1])
@test collect(evaluate_periodic_in_dyadic_points(Dual, DWT.wavelet, DWT.db1, 0,0,2,points=true)[2]) == collect(linspace(0,1,5)[1:end-1])
@test collect(evaluate_in_dyadic_points(Dual, DWT.wavelet, DWT.db1, 0,0,2,points=true)[2])==collect(linspace(0,1,5))
@test collect(evaluate_in_dyadic_points(Dual, DWT.wavelet, DWT.cdf24, 0,0,2,points=true)[2])==collect(linspace(-2,3,21))
f, points = evaluate_in_dyadic_points(Primal, scaling, DWT.db1, 2,0,1, points=true)
@test f == [2.]
@test points == linspace(0,0,1)
@test collect(points) == collect(linspace(0,0,1))
f3, points3 = evaluate_in_dyadic_points(Primal, wavelet, DWT.db3, 2,0,3, points=true)
f2, points2 = evaluate_in_dyadic_points(Primal, wavelet, DWT.db3, 2,0,2, points=true)
f1, points1 = evaluate_in_dyadic_points(Primal, wavelet, DWT.db3, 2,0,1, points=true)
Expand Down

0 comments on commit 11816db

Please sign in to comment.