This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Edgar Solomonik Parallel Numerical Algorithms 2 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Truncated SVDFast Algorithms with Truncated SVD
Rank-k Singular Value Decomposition (SVD)
For any matrix A ∈ Rm×n of rank k there exists a factorization
A = UDV T
U ∈ Rm×k is a matrix of orthonormal left singular vectorsD ∈ Rk×k is a nonnegative diagonal matrix of singularvalues in decreasing order σ1 ≥ · · · ≥ σkV ∈ Rn×k is a matrix of orthonormal right singular vectors
Edgar Solomonik Parallel Numerical Algorithms 3 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Truncated SVDFast Algorithms with Truncated SVD
Truncated SVD
Given A ∈ Rm×n seek its best k < rank(A) approximation
B = argminB∈Rm×n,rank(B)≤k
(||A−B||2)
Eckart-Young theorem: given SVD
A =[U1 U2
] [D1
D2
] [V1 V2
]T ⇒ B = U1D1VT1
where D1 is k × k.U1D1V
T1 is the rank-k truncated SVD of A and
||A−U1D1VT1 ||2 = min
B∈Rm×n,rank(B)≤k(||A−B||2) = σk+1
Edgar Solomonik Parallel Numerical Algorithms 4 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Truncated SVDFast Algorithms with Truncated SVD
Computational Cost
Given a rank k truncated SVD A ≈ UDV T of A ∈ Rm×n withm ≥ n
Performing approximately y = Ax requires O(mk) work
y ≈ U(D(V Tx))
Solving Ax = b requires O(mk) work via approximation
x ≈ V D−1UTb
Edgar Solomonik Parallel Numerical Algorithms 5 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Direct ComputationIndirect Computation
Computing the Truncated SVD
Reduction to upper-Hessenberg form via two-sided orthogonalupdates can compute full SVD
Given full SVD can obtain truncated SVD by keeping onlylargest singular value/vector pairs
Given set of transformations Q1, . . . ,Qs so thatU = Q1 · · ·Qs, can obtain leading k columns of U bycomputing
U1 = Q1
(· · ·(Qs
[I0
]))This method requires O(mn2) work for the computation ofsingular values and O(mnk) for k singular vectors
Edgar Solomonik Parallel Numerical Algorithms 6 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Direct ComputationIndirect Computation
Computing the Truncated SVD by Krylov SubspaceMethods
Seek k m,n leading right singular vectors of A
Find a basis for Krylov subspace of B = ATA
Rather than computing B, compute productsBx = AT (Ax)
For instance, do k′ ≥ k +O(1) iterations of Lanczos andcompute k Ritz vectors to estimate singular vectors V
Left singular vectors can be obtained via AV = UD
This method requires O(mnk) work for k singular vectors
However, Θ(k) sparse-matrix-vector multiplications areneeded (high latency and low flop/byte ratio)
Edgar Solomonik Parallel Numerical Algorithms 7 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Direct ComputationIndirect Computation
Generic Low-Rank Factorizations
A matrix A ∈ Rm×n is rank k, if for someX ∈ Rm×k,Y ∈ Rn×k
with k ≤ min(m,n),A = XY T
If A = XY T (exact low rank factorization), we can obtainreduced SVD A = UDV T via
1 [U1,R] = QR(X)2 [U2,D,V ] = SVD(RY T )3 U = U1U2
with cost O(mk2) using an SVD of a k × k rather thanm× n matrixIf instead ||A−XY T ||2 ≤ ε then ||A−UDV T ||2 ≤ εSo we can obtain a truncated SVD given an optimalgeneric low-rank approximation
Edgar Solomonik Parallel Numerical Algorithms 8 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Direct ComputationIndirect Computation
Rank-Revealing QR
If A is of rank k and its first k columns are linearly independent
A = Q
R11 R12
0 00 0
where R11 is upper-triangular and k × k and Q = Y TY T withn× k matrix Y
For arbitrary A we need column ordering permutation P
A = QRP
QR with column pivoting (due to Gene Golub) is aneffective method for this
pivot so that the leading column has largest 2-normmethod can break in the presence of roundoff error (seeKahan matrix), but is very robust in practice
Edgar Solomonik Parallel Numerical Algorithms 9 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Direct ComputationIndirect Computation
Low Rank Factorization by QR with Column Pivoting
QR with column pivoting can be used to either
determine the (numerical) rank of A
compute a low-rank approximation with a bounded errorperforms only O(mnk) rather than O(mn2) work for a full QR orSVD
Edgar Solomonik Parallel Numerical Algorithms 10 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Direct ComputationIndirect Computation
Parallel QR with Column Pivoting
In distributed-memory, column pivoting poses furtherchallenges
Need at least one message to decide on each pivotcolumn, which leads to Ω(k) synchronizations
Existing work tries to pivot many columns at a time byfinding subsets of them that are sufficiently linearlyindependent
Randomized approaches provide alternatives and flexibility
Edgar Solomonik Parallel Numerical Algorithms 11 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Matrix multiplications e.g. AW , all require O(mnk)operations
QR and SVD require O((m+ n)k2) operations
If k min(m,n) the bulk of the computation here is withinmatrix multiplication, which can be done with fewersynchronizations and higher efficiency than QR withcolumn pivoting or Arnoldi
Edgar Solomonik Parallel Numerical Algorithms 14 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Now lets consider the case when A = UDV T + E whereD ∈ Rk×k and E is a small perturbation
E may be noise in data or numerical errorTo obtain a basis for U it is insufficient to multiply byrandom B ∈ Rn×k, due to influence of EHowever, oversampling, for instance l = k + 10, andrandom B ∈ Rn×l gives good resultsA Gaussian random distribution provides particularly goodaccuracySo far the dimension of B has assumed knowledge of thetarget approximate rank k, to determine it dynamicallygenerate vectors (columns of B) one at a time or a block ata time, which results in a provably accurate basis
Edgar Solomonik Parallel Numerical Algorithms 15 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Consider two-way partitioning of vertices of a graphThe connectivity within each partition is given by a blockdiagonal matrix [
A1
A2
]If the graph is nicely separable there is little connectivitybetween vertices in the two partitionsConsequently, it is often possible to approximate theoff-diagonal blocks by low-rank factorization[
A1 U1D1VT1
U2D2VT2 A2
]Doing this recursively to A1 and A2 yields a matrix withhierarchical low-rank structure
Edgar Solomonik Parallel Numerical Algorithms 19 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
Consider multiplication C = AB where A ∈ Rn×n is HSS andB ∈ Rn×b
lets consider the case that p ≤ b n
if we assign each processor all of A, each can compute acolumn of C simultaneouslythis requires a prohibitive amount of memory usage
perform leaf-level multiplications, processing n/p rows of Bwith each processor (call intermediate C)transpose C and apply log2(p) root levels of HSS tree tocolumns of C independently
this algorithm requires replication only of the root O(log(p))levels of the HSS tree, O(pb) datafor large k or larger p different algorithms may be desirable
Edgar Solomonik Parallel Numerical Algorithms 35 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
References
Michiel E. Hochstenbach, A Jacobi–Davidson Type SVD Method, SIAMJournal on Scientific Computing 2001 23:2, 606-628
Chan, T. F. (1987). Rank revealing QR factorizations. Linear algebraand its applications, 88, 67-82.
Businger, P., and Golub, G. H. (1965). Linear least squares solutions byHouseholder transformations. Numerische Mathematik, 7(3), 269-276.
Edgar Solomonik Parallel Numerical Algorithms 36 / 37
Low Rank Approximation by SVDComputing Low Rank Approximations
Randomness and ApproximationHierarchical Low-Rank Structure
References
Quintana-Ortí, G., Sun, X., and Bischof, C. H. (1998). A BLAS-3 versionof the QR factorization with column pivoting. SIAM Journal on ScientificComputing, 19(5), 1486-1494.
Demmel, J.W., Grigori, L., Gu, M. and Xiang, H., 2015. Communicationavoiding rank revealing QR factorization with column pivoting. SIAMJournal on Matrix Analysis and Applications, 36(1), pp.55-89.
Bischof, C.H., 1991. A parallel QR factorization algorithm withcontrolled local pivoting. SIAM Journal on Scientific and StatisticalComputing, 12(1), pp.36-57.