JuliaMath / JuliaMath/FFTW.jl

Support the strided array interface

Open
#218 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
300
Forks
61
PR merge metrics
No merged PRs in 30d

Description

Note that Julia supports a [strided array interface](https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-strided-arrays). At the moment FFTW only works with `StridedArray` which means other types can't use it, see below example.

I assume this is an easy fix and just replace `::StridedArray` with `::AbstractArray`, as non-compatible types will error out on the call to `pointer`.

```julia
julia> using BlockArrays

julia> n = 10; x = PseudoBlockArray(randn(n), [5,5])
2-blocked 10-element PseudoBlockVector{Float64}:
0.13895184669862432
1.0296194237071945
0.831728129597864
-1.2760605104194878
1.225360630804565
────────────────────
2.9373002173159604
-0.20348560029959115
1.3919462067161756
-0.5452870826131355
0.6774104064065777

julia> strides(x)
(1,)

julia> pointer(x)
Ptr{Float64} @0x0000000141ab5770

julia> F = FFTW.plan_r2r(randn(n), FFTW.REDFT00);

julia> lmul!(randn(n), F, x)
ERROR: MethodError: no method matching lmul!(::Vector{Float64}, ::FFTW.r2rFFTWPlan{Float64, (3,), false, 1, UnitRange{Int64}}, ::PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}})
Stacktrace:
[1] top-level scope
@ REPL[9]:1
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.