| rcur {rsvd} | R Documentation |
Randomized CUR matrix decomposition.
rcur(A, k = NULL, p = 10, q = 0, idx_only = FALSE, rand = TRUE)
A |
array_like; |
k |
integer; |
p |
integer, optional; |
q |
integer, optional; |
idx_only |
bool, optional; |
rand |
bool, optional; |
Algorithm for computing the CUR matrix decomposition of a rectangular (m, n) matrix A, with target rank k << min(m,n). The input matrix is factored as
A = C * U * R
using the rid decomposition. The factor matrix C is formed using actual
columns of A, also called the partial column skeleton. The factor matrix R is formed
using actual rows of A, also called the partial row skeleton.
If rand=TRUE a probabilistic strategy is used to compute the decomposition, otherwise a deterministic algorithm is used.
rcur returns a list with class id containing the following components:
C |
array_like; |
R |
Array_like. |
U |
array_like; |
C.idx |
array_like; |
R.idx |
array_like; |
C.scores |
array_like; |
R.scores |
array_like; |
N. Benjamin Erichson, erichson@uw.edu
[1] N. Halko, P. Martinsson, and J. Tropp. "Finding structure with randomness: probabilistic algorithms for constructing approximate matrix decompositions" (2009). (available at arXiv http://arxiv.org/abs/0909.4061).
[2] N. B. Erichson, S. Voronin, S. Brunton, J. N. Kutz. "Randomized matrix decompositions using R" (2016). (available at 'arXiv http://arxiv.org/abs/1608.02148).
## Not run:
# Load test image
data('tiger')
# Compute (column) randomized interpolative decompsition
# Note that the image needs to be transposed for correct plotting
out <- rcur(tiger, k = 150)
# Reconstruct image
tiger.re <- out$C %*% out$U %*% out$R
# Compute relative error
print(norm(tiger-tiger.re, 'F') / norm(tiger, 'F'))
# Plot approximated image
image(tiger.re, col = gray((0:255)/255))
## End(Not run)