Skip to content

LinearAlgebra.norm(x, n) should be recursive? #1105

@WalterMadelim

Description

@WalterMadelim

The function LinearAlgebra.norm should be calculated in a global way. e.g. the 1-norm:

julia> function norm1(x) return LinearAlgebra.norm(x, 1) end
norm1 (generic function with 1 method)

julia> t = ([1 1; 0 0.], [0 0; 0 0.])
([1.0 1.0; 0.0 0.0], [0.0 0.0; 0.0 0.0])

julia> t[1]
2×2 Matrix{Float64}:
 1.0  1.0
 0.0  0.0

julia> t[2]
2×2 Matrix{Float64}:
 0.0  0.0
 0.0  0.0

julia> norm1(t) # this is strange because norm-2 feature is involved in a norm-1 function
1.4142135623730951

I think in practice people should expect the last result being 2.0, because we are calculating 1-norm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break codespeculativeWhether the change will be implemented is speculative

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions