Skip to content
DeepForgeby svx
All problems
EasyLinear Algebrala-024

Matrix 1-Norm (Max Column Sum)

Problem

Compute the induced matrix 1-norm: the maximum over columns of the sum of absolute entries in that column.

||A||_1 = max_j sum_i |A[i][j]|.

Hint

Sum down each column, then take the largest column total.

Test cases

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

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