# SparseMatrixCSC{Float} * Vector{SVector}

Julia allows me to multiply `Matrix{Float} * Vector{SVector}` :

``````using StaticArrays
A = rand(10,10)
x = rand(SVector{3, Float64}, 10)
A * x
``````

but not a `SparseMatrixCSC{Float} * Vector{SVector}` :

``````using SparseArrays, StaticArrays
B = sprand(10,10, 0.1)
x = rand(SVector{3, Float64}, 10)
B * x
``````

I get the following error:

``````julia> B * x
ERROR: MethodError: no method matching one(::Type{Any})
Closest candidates are:
one(::Type{Union{Missing, T}}) where T at missing.jl:87
one(::BitArray{2}) at bitarray.jl:400
one(::Missing) at missing.jl:83
...
Stacktrace:
[1] one(::Type{Any}) at ./missing.jl:87
[2] *(::SparseMatrixCSC{Float64,Int64}, ::Array{SArray{Tuple{3},Float64,1,3},1}) at /Users/ortner/gits/julia11/usr/share/julia/stdlib/v1.1/SparseArrays/src/linalg.jl:53
[3] top-level scope at none:0
``````

The relevant line numbers are

``````*(A::SparseMatrixCSC{TA,S}, x::StridedVector{Tx}) where {TA,S,Tx} =
(T = promote_type(TA, Tx); mul!(similar(x, T, A.m), A, x, one(T), zero(T)))
``````

So I first need to define `promote_type` for `TA = T, Tx = SVector{T}`. Then I need to define `one` for `SVector{T}`. But even then it doesn’t work because `mul!` expects numbers:

``````function mul!(C::StridedVecOrMat, A::SparseMatrixCSC, B::StridedVecOrMat, α::Number, β::Number)
...
``````

Maybe this is typed too strictly?

Would it be worthwhile opening issues in both `StaticArrays.jl` as well as `SparseArrays` about these, or is this just too specialised?

Are there any potential problems defining `promote_type` and `one` as I envision?