LazyAlgebra.jl
LazyAlgebra.jl copied to clipboard
Type `Floats` cannot support Unitful vectors
The Floats
type used here is a union of AbstractFloats and Complex and is a very sensible type for the goals of this package. Unfortunately that union is not quite general enough to include Unitful vectors because such vector's elements are subtypes of Number
not of AbstractFloat
. So simple methods like vscale!
do not apply as currently written. MWE:
using LazyAlgebra
using Unitful: m
x = ones(5) * 1m
vscale!(x, 2)
ERROR: MethodError: no method matching vscale!(::Vector{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}, ::Int64, ::Vector{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}})
It probably would be a major undertaking to support Unitful vectors here, so I am not really advocating for that. But I am just reporting the issue here because it is relevant to another PR elsewhere:
https://github.com/emmt/LinearInterpolators.jl/pull/9