Skip to content

Commit

Permalink
Merge pull request #9 from JuliaArrays/teh/fix07
Browse files Browse the repository at this point in the history
Fix on 0.7
  • Loading branch information
timholy authored Sep 21, 2017
2 parents aea1910 + b4d4929 commit f12b9d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
julia 0.6
CustomUnitRanges
Compat 0.17
FFTW
Compat 0.32
15 changes: 8 additions & 7 deletions src/FFTViews.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ __precompile__(true)
module FFTViews

using Base: tail, unsafe_length
using Compat
importall FFTW
using Compat # for Val(N) and AbstractRange

# A custom rangetype that will be used for indices and never throws a
# boundserror because the domain is actually periodic.
Expand All @@ -13,7 +14,7 @@ include(CustomUnitRanges.filename_for_urange)
Base.checkindex(::Type{Bool}, inds::URange, ::Base.Slice) = true
Base.checkindex(::Type{Bool}, inds::URange, ::Base.LogicalIndex) = true
Base.checkindex(::Type{Bool}, inds::URange, ::Real) = true
Base.checkindex(::Type{Bool}, inds::URange, ::Range) = true
Base.checkindex(::Type{Bool}, inds::URange, ::AbstractRange) = true
Base.checkindex(::Type{Bool}, inds::URange, ::AbstractVector{Bool}) = true
Base.checkindex(::Type{Bool}, inds::URange, ::AbstractArray{Bool}) = true
Base.checkindex(::Type{Bool}, inds::URange, ::AbstractArray) = true
Expand Down Expand Up @@ -60,12 +61,12 @@ function Base.similar(f::Union{Function,Type}, shape::Tuple{URange,Vararg{URange
end

Base.reshape(F::FFTView{_,N}, ::Type{Val{N}}) where {_,N} = F
Base.reshape(F::FFTView{_,M}, ::Type{Val{N}}) where {_,M,N} = FFTView(reshape(parent(F), Val{N}))
Base.reshape(F::FFTView{_,M}, ::Type{Val{N}}) where {_,M,N} = FFTView(reshape(parent(F), Val(N)))

Base.fft(F::FFTView; kwargs...) = fft(parent(F); kwargs...)
Base.rfft(F::FFTView; kwargs...) = rfft(parent(F); kwargs...)
Base.fft(F::FFTView, dims; kwargs...) = fft(parent(F), dims; kwargs...)
Base.rfft(F::FFTView, dims; kwargs...) = rfft(parent(F), dims; kwargs...)
FFTW.fft(F::FFTView; kwargs...) = fft(parent(F); kwargs...)
FFTW.rfft(F::FFTView; kwargs...) = rfft(parent(F); kwargs...)
FFTW.fft(F::FFTView, dims; kwargs...) = fft(parent(F), dims; kwargs...)
FFTW.rfft(F::FFTView, dims; kwargs...) = rfft(parent(F), dims; kwargs...)

@inline reindex(::Type{V}, inds, I) where {V} = (_reindex(V, inds[1], I[1]), reindex(V, tail(inds), tail(I))...)
reindex(::Type{V}, ::Tuple{}, ::Tuple{}) where {V} = ()
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FFTViews
importall FFTW
using Base.Test

function test_approx_eq_periodic(a::FFTView, b)
Expand Down

0 comments on commit f12b9d8

Please sign in to comment.