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

simplify norm computations. #43190

Merged
merged 6 commits into from
Nov 29, 2021
Merged
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions stdlib/LinearAlgebra/src/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,11 @@ diag(A::AbstractVector) = throw(ArgumentError("use diagm instead of diag to cons
# Dot products and norms

# special cases of norm; note that they don't need to handle isempty(x)
generic_normMinusInf(x) = mapreduce(norm, min, x)
generic_normMinusInf(x) = float(mapreduce(norm, min, x))

generic_normInf(x) = mapreduce(norm, max, x)
generic_normInf(x) = float(mapreduce(norm, max, x))

generic_norm1(x) = mapreduce(norm, +, x)
generic_norm1(x) = float(mapreduce(norm, +, x))
oscardssmith marked this conversation as resolved.
Show resolved Hide resolved

# faster computation of norm(x)^2, avoiding overflow for integers
norm_sqr(x) = norm(x)^2
Expand Down