当前位置: 首页 > 工具软件 > log4j-finder > 使用案例 >

Fast Randomized Range Finder -- By structured random matrix

微生昌勋
2023-12-01

(Note: The following content is mainly excerpted from the reference [1] , [2] and [3] listed at the bottom.)


1 (Dense) Random projection method

To construct a subspace that captures the action of a matrix, that is, developing an algorithm for constructing low-rank approximation to the original matrix. The most common method is using the randomized projection method, as the following algorithm, named Randomized range finder [1].


Algorithm1: Randomized range finder
Input: A ∈ R m × n A \in R^{m\times n} ARm×n and an integer l l l;
Output: An orthonormal matrix Q ∈ R m × l Q\in R^{m\times l} QRm×l whose range approximates the range of A A A
Steps:

  1. Draw an n × l n\times l n×l Gaussian random matrix Ω \Omega Ω;
  2. Form the m × l m \times l m×l matrix Y = A Ω Y=A\Omega Y=AΩ;
  3. Construct an m × l m \times l m×l matrix Q Q Q whose columns form an orthonormal basis for the range of Y Y Y, e.g., using the QR factorization Y = Q R Y=QR Y=QR.

Here, the entries of the random matrix Ω \Omega Ω obey the Gaussian distribution, thus Ω \Omega Ω is a dense matrix.

The bottleneck in the above algorithm is the computation of the matrix product A Ω A\Omega AΩ. When Ω \Omega Ω is standard Gaussian, the cost of this multiplication is O ( m n l ) O(mnl) O(mnl), the same as a rank-revealing QR algorithm.

The Key idea is to use a structured random matrix that allow us to compute the product in O ( m n log ⁡ ( l ) ) O(mn\log(l)) O(mnlog(l)) flops.


2 (Sparse) Random projection method

2.1 SRFT

[4] proposed a subsampled random Fourier transform (SRFT), which is perhaps the simplest example of a structured random matrix that meets the above goals.

Specifically, an SRFT is an n × l n\times l n×l matrix of the following form
Ω = n l D F R , (1) \Omega = \sqrt{\frac{n}{l}} DFR, \tag{1} Ω=ln DFR,(1)
where

  • D D D is an n × n n\times n n×n diagonal matrix whose entries are independent random variables uniformly distributed on the complex unit circle;
  • F F F is the n × n n\times n n×n unitary discrete Fourier transform (DFT), whose entries take the values
    f p q = 1 n e − 2 π i ( p − 1 ) ( q − 1 ) n f_{pq} = \frac{1}{\sqrt{n}}e^{\frac{-2\pi i(p-1)(q-1)}{n}} fpq=n 1en2πi(p1)(q1)
    for p , q = 1 , 2 , ⋯   , n p,q=1,2,\cdots, n p,q=1,2,,n;
  • R R R is an n × l n\times l n×l matrix that samples l l l coordinates from n n n uniformly at random; i.e., its l l l columns are drawn randomly without replacement from the columns of the n × n n\times n n×n identity matrix.

Then we can compute the sample matrix Y = A Ω Y=A\Omega Y=AΩ using O ( m n log ⁡ ( l ) ) O(mn\log(l)) O(mnlog(l)) flops via a subsampled FFT [4]. Then form the basis Q Q Q by orthonormalizing the columns of Y Y Y. See the following algorithm for details.


Algorithm2: Fast Randomized range finder
Input: A ∈ R m × n A \in R^{m\times n} ARm×n and an integer l l l;
Output: An orthonormal matrix Q ∈ R m × l Q\in R^{m\times l} QRm×l whose range approximates the range of A A A
Steps:

  1. Draw an n × l n\times l n×l SRFT test matrix Ω \Omega Ω, as defined in (1);
  2. Form the m × l m \times l m×l matrix Y = A Ω Y=A\Omega Y=AΩ using a (subsampled ) FFT;
  3. Construct an m × l m \times l m×l matrix Q Q Q whose columns form an orthonormal basis for the range of Y Y Y, e.g., using the QR factorization Y = Q R Y=QR Y=QR.

2.2 SEM

[2] proposed another sparse randomzied maritx named sparse embedding matrix (SEM).

Consider the random linear map S = Φ D S=\Phi D S=ΦD, where S ∈ R k × n S\in R^{k\times n} SRk×n, such that for h : { 1 , ⋯   , n } → { 1 , ⋯   , k } h:\{1,\cdots, n\}\rightarrow \{1,\cdots,k\} h:{1,,n}{1,,k}, a random map such that for each i ∈ { 1 , ⋯   , n } i\in \{1,\cdots,n\} i{1,,n}, h ( i ) = t ′ h(i)=t' h(i)=t for t ′ ∈ { 1 , ⋯   , k } t'\in \{1,\cdots,k\} t{1,,k}, with probability 1 / t 1/t 1/t, for a parameter t ∈ N t\in N tN we have

  1. Φ ∈ { 0 , 1 } k × n ( k ≤ n ) \Phi \in \{0,1\}^{k\times n} (k\leq n) Φ{0,1}k×n(kn) binary matrix with nonzero entries Φ h ( i ) , i = 1 \Phi_{h(i),i}=1 Φh(i),i=1 and all the remaining entries equal to 0 0 0. In other words, Φ \Phi Φ is a matrix with a single 1 1 1 in each column.
  2. D D D is an n × n n\times n n×n random diagonal matrix where each diagonal entry is independently chosen to be either + 1 +1 +1 or − 1 -1 1 with equal probabiltity.

A matrix S S S that satisfies 1 & 2 1\&2 1&2 is referred to as a sparse embedding matrix (SEM).

(Refer to Reference [2] for details.)


References:
[1] N.Halko, P.G.Martinsson, J.A.Tropp. Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions. SIAM Review, 2(53):217-288, 2011.
[2] Yariv Aizenbuda, Gil Shabatb, Amir Averbuchb. Randomized LU decomposition using sparse projections. Computers & Mathematics with Applications, 9(72): 2525-2534, 2016.
[3] 殷术亨. 矩阵 LU 分解及 Cholesky 分解的随机算法研究[D], 重庆大学, 2020.
[4] F. Woolfe, E. Liberty, V. Rokhlin, and M. Tygert. A fast randomized algorithm for the approximation of matrices, Appl. Comput. Harmon, Anal., 25: 335-366, 2008.

 类似资料:

相关阅读

相关文章

相关问答