Skip to content

convert AbstractVector to StridedVector in mul!? #217

@dlfivefifty

Description

@dlfivefifty

Should calling lmul! with something that's not a StridedArray error out like this?

julia> n = 10; F = FFTW.plan_r2r(randn(n), FFTW.REDFT00)
FFTW r2r REDFT00 plan for 10-element array of Float64
(redft00e-r2hc-pad-10
  (rdft-ct-dit/3
    (hc2hc-direct-3/4 "hf_3"
      (rdft-r2hc-direct-r2c-3 "r2cf_3")
      (rdft-r2hc01-direct-r2c-3 "r2cfII_3"))
    (rdft-r2hc-directbuf/10-r2c-6-x3 "r2cf_6"))
  (rdft-rank0-iter-ci/10))

julia> x = 1:n;

julia> F*x
10-element Vector{Float64}:
  99.0
 -33.16343747752636
   0.0
  -4.0
   0.0
  -1.7040881910418477
   0.0
  -1.1324743314317942
   0.0
  -1.0

julia> mul!(similar(1.0x),F,x)
ERROR: MethodError: no method matching mul!(::Vector{Float64}, ::FFTW.r2rFFTWPlan{Float64, (3,), false, 1, UnitRange{Int64}}, ::UnitRange{Int64}, ::Bool, ::Bool)
Closest candidates are:
  mul!(::AbstractVector{T} where T, ::Union{Bidiagonal, SymTridiagonal, Tridiagonal}, ::AbstractVector{T} where T, ::Number, ::Number) at /Users/sheehanolver/Projects/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/bidiag.jl:398
  mul!(::AbstractVecOrMat{T} where T, ::Union{Bidiagonal, SymTridiagonal, Tridiagonal}, ::AbstractVecOrMat{T} where T, ::Number, ::Number) at /Users/sheehanolver/Projects/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/bidiag.jl:400
  mul!(::AbstractVector{T} where T, ::Transpose{var"#s832", var"#s831"} where {var"#s832", var"#s831"<:Diagonal}, ::AbstractVector{T} where T, ::Number, ::Number) at /Users/sheehanolver/Projects/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/diagonal.jl:322
  ...
Stacktrace:
 [1] mul!(C::Vector{Float64}, A::FFTW.r2rFFTWPlan{Float64, (3,), false, 1, UnitRange{Int64}}, B::UnitRange{Int64})
   @ LinearAlgebra ~/Projects/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/matmul.jl:275
 [2] top-level scope
   @ REPL[11]: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