diff --git a/Project.toml b/Project.toml index fe0185a..417cd10 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "AbstractFFTs" uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c" -version = "1.0.0" +version = "1.0.1" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -10,6 +10,7 @@ julia = "^1.0" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [targets] -test = ["Test"] +test = ["Test", "Unitful"] diff --git a/README.md b/README.md index f11d5ce..89f7d48 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Documentation: [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaMath.github.io/AbstractFFTs.jl/latest) This package is mainly not intended to be used directly. -Instead, developers of packages that implement FFTs (such as [FFTW.jl](https://github.com/JuliaMath/FFTW.jl)) +Instead, developers of packages that implement FFTs (such as [FFTW.jl](https://github.com/JuliaMath/FFTW.jl) or [FastTransforms.jl](https://github.com/JuliaApproximation/FastTransforms.jl)) extend the types/functions defined in `AbstractFFTs`. This allows multiple FFT packages to co-exist with the same underlying `fft(x)` and `plan_fft(x)` interface. diff --git a/docs/src/implementations.md b/docs/src/implementations.md index 4bdd8bd..632a602 100644 --- a/docs/src/implementations.md +++ b/docs/src/implementations.md @@ -6,6 +6,8 @@ The following packages extend the functionality provided by AbstractFFTs: * [FFTW.jl](https://github.com/JuliaMath/FFTW.jl): Bindings for the [FFTW](http://www.fftw.org) library. This also used to be part of Base Julia. +* [FastTransforms.jl](https://github.com/JuliaApproximation/FastTransforms.jl): + Pure-Julia implementation of FFT, with support for arbitrary AbstractFloat types. ## Defining a new implementation diff --git a/src/definitions.jl b/src/definitions.jl index 6551747..e8bda0a 100644 --- a/src/definitions.jl +++ b/src/definitions.jl @@ -419,8 +419,8 @@ Broadcast.broadcasted(::typeof(*), x::Number, f::Frequencies) = Broadcast.broadc Broadcast.broadcasted(::typeof(/), f::Frequencies, x::Number) = Frequencies(f.n_nonnegative, f.n, f.multiplier / x) Broadcast.broadcasted(::typeof(\), x::Number, f::Frequencies) = Broadcast.broadcasted(/, f, x) -Base.maximum(f::Frequencies) = (f.n_nonnegative - ifelse(f.multiplier >= 0, 1, f.n)) * f.multiplier -Base.minimum(f::Frequencies) = (f.n_nonnegative - ifelse(f.multiplier >= 0, f.n, 1)) * f.multiplier +Base.maximum(f::Frequencies{T}) where T = (f.n_nonnegative - ifelse(f.multiplier >= zero(T), 1, f.n)) * f.multiplier +Base.minimum(f::Frequencies{T}) where T = (f.n_nonnegative - ifelse(f.multiplier >= zero(T), f.n, 1)) * f.multiplier Base.extrema(f::Frequencies) = (minimum(f), maximum(f)) """ diff --git a/test/runtests.jl b/test/runtests.jl index 4c6bb3f..afa6d0d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,8 @@ using AbstractFFTs: Plan using LinearAlgebra using Test +import Unitful + @testset "rfft sizes" begin A = rand(11, 10) @test @inferred(AbstractFFTs.rfft_output_size(A, 1)) == (6, 10) @@ -131,7 +133,7 @@ end @test f(freqs) == f(collect(freqs)) == f(fftshift(freqs)) end end - for f in (fftfreq, rfftfreq), n in (8, 9), multiplier in (2, 1/3, -1/7) + for f in (fftfreq, rfftfreq), n in (8, 9), multiplier in (2, 1/3, -1/7, 1.0*Unitful.mm) freqs = f(n, multiplier) check_extrema(freqs) end