Exercise 1.1.24

Create a 3 by 2 matrix A with rank 2. Factor A into A = CMR. The reason for this page is that the factorizations A = CR and A = CMR have jumped forward in importance for large matrices. When C takes columns directly from A, and R takes rows directly from A, those matrices preserve properties that are lost in the more famous QR and SVD factorizations. Where A = QR and A = UΣV T involve orthogonalizing the vectors, C and R keep the original data:

  • If A is nonnegative, so are C and R.
  • If A is sparse, so are C and R.

Answers

We pick A = [13 2 5 36 ], then we have

A = CR = [13 2 5 36 ]I.

Pick R = [13 2 5 ], so we have

M = [ 8 11 15 23 ].
import numpy as np 
 
R = np.array([[1, 3], [2,5]])#.reshape(1,2) 
A = np.array([[1,3],[2,5],[3,6]]) 
C = A 
 
a = np.matmul(C.transpose(), A) 
b = np.matmul(a, R.transpose()) 
k = np.matmul(C.transpose(), C) 
invc = np.linalg.inv(k) 
invr = np.linalg.inv(np.matmul(R, R.transpose())) 
m = np.matmul(a, b) 
f = np.matmul(invc, m) 
f = np.matmul(f, invr) 
invc, invr, m, f
(array([[ 3.68421053, -1.63157895],
        [-1.63157895,  0.73684211]]), array([[ 29., -17.],
        [-17.,  10.]]), array([[ 8969, 15334],
        [20187, 34513]]), array([[ -8.,  11.],
        [-15.,  23.]]))

User profile picture
2020-03-20 00:00
Comments