Skip to content

Type Floats cannot support Unitful vectors #4

Description

@JeffFessler

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:

emmt/LinearInterpolators.jl#9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions