JuliaLang / JuliaLang/LinearAlgebra.jl
Should L1 and L∞ Norms of Integer Vectors/Matrices be Integers?
Open
Nobody has claimed this yet.
breaking
needs decision
- Dominant language
- Julia
- Stars
- 77
- Forks
- 65
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 10
Description
It appears norm() returns floats for L1 and L∞ norms of integer arrays and matrices. Is this desired behavior? For reference, Python's SymPy returns integers in these cases.
Example:
using LinearAlgebra
Q = Array{BigInt,2}([0 0 1 0 2 0; 0 0 0 1 0 0; 1 0 0 1 0 2; 0 2 1 0 0 0; 1 0 0 0 0 0; 0
0 1 0 0 0])
r = Array{BigInt,2}([1 0 0 0 0 0]')
p = sum(Q^400*r)
q = norm(Q^400*r,1)
println(p)
println(q)
println(p-q)
Output:
599105291862848723668207669580395292943637098083701173062263490608359686886822443854726721692632230014822475550014198880241782518191032868274176
5.991052918628487236682076695803952929436370980837011730622634906083596868868222e+143
2.03493795765715104048118598582576955589097915016187079301972099072e+65
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided Julia example using LinearAlgebra.norm() on the BigInt vector and matrix result. Review the norm() behavior and documentation for integer inputs; done means deciding and documenting whether L1 and L∞ should preserve integer results, with regression coverage if a change is agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100