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

Revert from generic_norm2 to norm #647

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ferrolho
Copy link
Member

@ferrolho ferrolho commented Nov 8, 2024

This reverts commit 10de215.

As shown below, norm(a) is as precise as norm(Array(a)).

julia> using BenchmarkTools, LinearAlgebra, StaticArrays

julia> a = SA[0, 1e-180]
2-element SVector{2, Float64} with indices SOneTo(2):
 0.0
 1.0e-180

julia> norm(a)
1.0e-180

julia> norm(Array(a))
1.0e-180

julia> a
2-element SVector{2, Float64} with indices SOneTo(2):
 0.0
 1.0e-180

julia> @btime norm($(Ref(a))[]) # standard norm of static array
  2.500 ns (0 allocations: 0 bytes)
1.0e-180

julia> @btime norm($(Ref(Vector(a)))[]) # standard norm of array
  6.792 ns (0 allocations: 0 bytes)
1.0e-180

julia> @btime LinearAlgebra.generic_norm2($(Ref((a)))[]) # generic_norm2 of static array
  3.334 ns (0 allocations: 0 bytes)
1.0e-180

julia> @btime LinearAlgebra.generic_norm2($(Ref(Vector(a)))[]) # generic_norm2 of array
  6.666 ns (0 allocations: 0 bytes)
1.0e-180

Related to #622 and JuliaArrays/StaticArrays.jl#913.

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 this pull request may close these issues.

1 participant