def algo_3(A, l=8, method='srft', verbose=False): """ Computes the third algorithm """ if verbose: print "Computing Fast Randomized Range Finder" Q, _ = fast_randomized_range_finder(A, l=l, method=method) if verbose: print "Compute direct SVD" # return row_extraction_svd(A, Q) return direct_svd(A, Q)
def compute_eig(A, q=0, l=100): """ Compute Eigenvalue using Randomized Power Iteration and direct eigenvalue decomposition Parameters ---------- """ Q = randomized_power_iteration(A, l=l, q=q) _, e, _ = direct_svd(A, Q) e.sort() return e[::-1]
def algo_2(A, l=8): """ Computes the second algorithm Step A: Direct range finder Step B: Direct SVD Parameters ---------- A: array Returns ------- U, S, V : SVD decomposition """ Q, R = randomized_range_finder(A, l=l) return direct_svd(A, Q)
def algo_1(A): """ Computes the first algorithm Step A: rank revealing QR, suing wolumn pivoting and HouseHolder reflector Step B: algo 5.1 (direct SVD) Parameters ---------- A: array Returns ------- U, S, V : SVD decomposition """ Q, R = qr(A, mode='qr') return direct_svd(A, Q)
def algo_3(A, l=8, method='srft'): """ Computes the third algorithm """ Q, _ = fast_randomized_range_finder(A, l=l, method=method) return direct_svd(A, Q)