Skip to content

Support the strided array interface #218

Open
@dlfivefifty

Description

@dlfivefifty

Note that Julia supports a strided array interface. 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> 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions