All problems
RRQR Pivot Selection
Problem
Perform one rank-revealing QR pivot selection step: find the column of A with the largest 2-norm and move it to the first column, shifting the columns before it to the right.
If several columns tie, choose the leftmost one. Return the reordered matrix.
Hint
Moving the largest column to the front maximizes the first pivot in magnitude.
Test cases
case 1
in: [[[1,0,3],[0,1,4]]]
expected: [[3,0,1],[4,1,0]]
case 2
in: [[[2,1],[0,0]]]
expected: [[2,1],[0,0]]
case 3
in: [[[1,2],[0,0],[0,0]]]
expected: [[2,1],[0,0],[0,0]]
case 4
in: [[[0,1],[1,0]]]
expected: [[0,1],[1,0]]
Starter codePython
def rrqr_select_column(A):
# Your code here
pass4 test cases · run your code against them in the editor