fix project 1 q1 bug
This commit is contained in:
@@ -38,9 +38,13 @@ def proj_SVD(A:np.ndarray, b:np.ndarray) -> np.ndarray:
|
||||
= U S V^* (V S^2 V^*)^(-1) V S U^* b
|
||||
= U S V^* V S^(-2) V^* V S U^* b
|
||||
= U U^* b
|
||||
If A = U S V^*, then the projection onto the column space of A is:
|
||||
proj_A(b) = U_r U_r^* b
|
||||
where U_r are the left singular vectors corresponding to nonzero singular values.
|
||||
"""
|
||||
U_r = U[:, :np.linalg.matrix_rank(A)] # Take only the relevant columns
|
||||
# Compute the projection using the SVD components
|
||||
projection = U @ U.conj().T @ b
|
||||
projection = U_r @ U_r.conj().T @ b
|
||||
return projection
|
||||
|
||||
def build_A(eps: float) -> np.ndarray:
|
||||
|
||||
Reference in New Issue
Block a user