-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
I was writing an optimization algorithm and wanted it to work with scalars and vectors. I noticed that norm and dot aren't defined for scalar numbers.
julia> norm(1.0)
no method norm(Float64,)
in method_missing at base.jl:60
julia> dot(1.0,2.0)
no method dot(Float64,Float64)
in method_missing at base.jl:60The definitions would be simple:
norm(x::Number) = x
dot(x::Number, y::Number) = x*yThere might be more functions to consider defining for scalars as well.
Metadata
Metadata
Assignees
Labels
No labels