Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unitful SVector norm broken #1124

Closed
aplavin opened this issue Feb 10, 2023 · 1 comment · Fixed by #1125
Closed

Unitful SVector norm broken #1124

aplavin opened this issue Feb 10, 2023 · 1 comment · Fixed by #1125

Comments

@aplavin
Copy link
Member

aplavin commented Feb 10, 2023

A recent version broke norm on SVectors with Unitful values:

julia> using LinearAlgebra, Unitful, StaticArrays

julia> norm(SVector(1.0*u"m"))
ERROR: DimensionError: 0.0 and 1.0 m are not dimensionally compatible.
Stacktrace:
 [1] _lt
   @ ~/.julia/packages/Unitful/fbiNW/src/quantities.jl:268 [inlined]
 [2] <(x::Quantity{Float64, NoDims, Unitful.FreeUnits{(), NoDims, nothing}}, y::Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}})
   @ Unitful ~/.julia/packages/Unitful/fbiNW/src/quantities.jl:258
 [3] <(x::Int64, y::Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}})
   @ Unitful ~/.julia/packages/Unitful/fbiNW/src/quantities.jl:260
 [4] macro expansion
   @ ~/.julia/packages/StaticArrays/IUOG2/src/linalg.jl:268 [inlined]
 [5] _norm
   @ ~/.julia/packages/StaticArrays/IUOG2/src/linalg.jl:256 [inlined]
 [6] norm(a::SVector{1, Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}})
   @ StaticArrays ~/.julia/packages/StaticArrays/IUOG2/src/linalg.jl:255
 [7] top-level scope
   @ REPL[7]:1

This worked just fine before.

@mateuszbaran
Copy link
Collaborator

It's probably because of #1116. It looks like a simple issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants