Skip to content
DeepForgeby svx
All problems
EasyLinear Algebrala-102

Matrix Infinity Norm

Problem

Compute the induced matrix infinity norm: the maximum over rows of the sum of absolute entries in that row.

||A||_inf = max_i sum_j |A[i][j]|

Hint

Sum across each row, then take the largest row total.

Test cases

case 1
in: [[[1,-2],[3,-4]]]
expected: 7
case 2
in: [[[1,2,3],[4,5,6]]]
expected: 15
case 3
in: [[[0,0],[0,0]]]
expected: 0
case 4
in: [[[-1.5,2]]]
expected: 3.5
Starter codePython
def matrix_inf_norm(A):
    # Your code here
    pass

4 test cases · run your code against them in the editor