Skip to content

Commit

Permalink
Merge branch 'master' into feature/median
Browse files Browse the repository at this point in the history
  • Loading branch information
stev47 committed Dec 22, 2024
2 parents e4ee876 + b23d668 commit 1e1a1f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "StaticArrays"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.9.8"
version = "1.9.9"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
4 changes: 2 additions & 2 deletions src/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ end
$(Expr(:meta, :inline))
scale = maxabs_nested(a)

scale==0 && return _init_zero(a)
iszero(scale) && return _init_zero(a)
p == 1 && return @inbounds scale * $expr_p1
return @inbounds scale * ($expr)^(inv(p))
end
Expand All @@ -328,7 +328,7 @@ end
p == Inf && return mapreduce(norm, max, a) # no need for scaling

l = p==1 ? @inbounds($expr_p1) : @inbounds(($expr)^(inv(p)))
0<l<Inf && return l
zero(l) < l && isfinite(l) && return l
return _norm_scaled(Size(a), a, p) # p != 0, 2, Inf
end
end
Expand Down
3 changes: 3 additions & 0 deletions test/unitful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ using Unitful
@test norm(SVector(1.0*u"m")) == 1.0*u"m"
# issue $1127
@test norm(SVector(0.0, 0.0)*u"nm") == 0.0*u"nm"

@test norm(SVector(1.0, 2.0)*u"m", 1) == 3.0*u"m"
@test norm(SVector(0.0, 0.0)*u"nm", 1) == 0.0*u"nm"
end

0 comments on commit 1e1a1f7

Please sign in to comment.