Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.5.24"
version = "1.5.25"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
3 changes: 2 additions & 1 deletion src/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ end

m = maxabs_nested(a[1])
for j = 2:prod(size(a))
m = @fastmath max(m, maxabs_nested(a[j]))
m = max(m, maxabs_nested(a[j]))
end

return m
Expand All @@ -246,6 +246,7 @@ end
return quote
$(Expr(:meta, :inline))
scale = maxabs_nested(a)
!isfinite(scale) && return scale

iszero(scale) && return _init_zero(a)
return @inbounds scale * sqrt($expr)
Expand Down
17 changes: 17 additions & 0 deletions test/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,23 @@ end
@test norm(SA[SVector{0,Int}(),SVector{0,Int}()]) isa float(Int)
@test norm(SA[SVector{0,Int}(),SVector{0,Int}()]) == norm([Int[], Int[]])

# norm of SVector with NaN and/or Inf elements -- issue #1135
@test isnan(norm(SA[0.0, NaN]))
@test isnan(norm(SA[NaN, 0.0]))
@test norm(SA[0.0, Inf]) == Inf
@test norm(SA[Inf, 0.0]) == Inf
@test norm(SA[0.0, -Inf]) == Inf
@test norm(SA[-Inf, 0.0]) == Inf
@test norm(SA[Inf, Inf]) == Inf
@test norm(SA[-Inf, -Inf]) == Inf
@test norm(SA[Inf, -Inf]) == Inf
@test norm(SA[-Inf, Inf]) == Inf
@test isnan(norm(SA[Inf, NaN]))
@test isnan(norm(SA[NaN, Inf]))
@test isnan(norm(SA[-Inf, NaN]))
@test isnan(norm(SA[NaN, -Inf]))
@test isapprox(SA[0.0, NaN], SA[0.0, NaN], nans=true)

# no allocation for MArray -- issue #1126

@inline function calc_particle_forces!(s, pos1, pos2)
Expand Down