C1_W2_Assignment Exercise 4 - incorrect reshape

Hello,

When running the code below, I get a completely incorrect matrix shape after reshaping. Can someone please assist?

def augmented_to_ref(A, b):    
    ### START CODE HERE ###
   
   # moderator edit: code removed

    ### END CODE HERE ###
    
    return A_ref

A_ref = augmented_to_ref(A, b)

print(A_ref)

[[ 2.         -1.          1.          1.        ]
 [ 1.          2.         -1.         -1.        ]
 [-1.          2.          2.          2.        ]
 [-0.52941176  1.          0.82352941  0.88235294]]
Expected Output
[[ 1  2 -1 -1  3]
 [ 0  1  4  3 22]
 [ 0  0  1  3  7]
 [ 0  0  0  1  1]]

Apparently the reshape did not help?

Figured it out!

Was using the wrong matrix. Was using A_system instead of A_ref

I’m glad you solved the issue.

Please remember to not post your code on the forum. That’s not allowed by the Code of Conduct.