Skip to content

Commit

Permalink
Use AbstractFFTs instead of FFTW
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored Oct 3, 2023
1 parent ae70f46 commit e2ae064
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
name = "KernelDensity"
uuid = "5ab0869b-81aa-558d-bb23-cbf5423bbe9b"
authors = ["Simon Byrne and various contributors"]
version = "0.6.7"
version = "0.7.0"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
AbstractFFTs = "1"
Distributions = "0.23, 0.24, 0.25"
DocStringExtensions = "0.8, 0.9"
FFTW = "1"
Interpolations = "0.9, 0.10, 0.11, 0.12, 0.13, 0.14"
StatsBase = "0.33, 0.34"
julia = "1"

[extras]
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["FFTW", "Test"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Kernel density estimators for Julia.

## Usage

### Prerequisite

The kernel density estimates are computed with fast Fourier transforms (FFTs) internally using the [AbstractFFTs.jl](https://github.com/JuliaMath/AbstractFFTs.jl) interface.
You have to load a backend such as [FFTW.jl](https://github.com/JuliaMath/FFTW.jl) that implements this interface:

```julia
using FFTW
```

### Univariate
The main accessor function is `kde`:

Expand Down
2 changes: 1 addition & 1 deletion src/KernelDensity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Distributions
using Interpolations

import Distributions: twoπ, pdf
import FFTW: rfft, irfft
using AbstractFFTs: rfft, irfft

export kde, kde_lscv, UnivariateKDE, BivariateKDE, InterpKDE, pdf

Expand Down
1 change: 1 addition & 0 deletions test/bivariate.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Test
using Distributions
using KernelDensity
using FFTW

import KernelDensity: kernel_dist, default_bandwidth, kde_boundary, kde_range, tabulate

Expand Down
1 change: 1 addition & 0 deletions test/interp.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Test
using KernelDensity
using FFTW

X = randn(100)
Y = randn(100)
Expand Down
1 change: 1 addition & 0 deletions test/univariate.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Test
using Distributions
using KernelDensity
using FFTW

import KernelDensity: kernel_dist, default_bandwidth, kde_boundary, kde_range, tabulate

Expand Down

0 comments on commit e2ae064

Please sign in to comment.