
Last chance! 50% off unlimited learning
Sale ends in
Randomized interpolative decomposition.
rid(A, k = NULL, mode = "column", p = 10, q = 0, idx_only = FALSE, rand = TRUE)
array_like;
numeric
integer, optional;
number of rows/columns to be selected.
It is required that
string c('column', 'row'), optional; columns or rows ID.
integer, optional;
oversampling parameter (default
integer, optional.
number of additional power iterations (default
bool, optional;
if (idx
is returned, but not the matrix C
or R
.
This is more memory efficient, when dealing with large-scale data.
bool, optional;
if (
rid
returns a list containing the following components:
array_like;
column subset mode='column'
; array with dimensions
array_like;
row subset mode='row'
; array with dimensions
array_like;
well conditioned matrix; Depending on the selected mode, this is an
array with dimensions
array_like;
index set of the
array_like; information on the pivoting strategy used during the decomposition.
array_like;
scores of the columns or rows of the input matrix
array_like;
scores of the
Algorithm for computing the ID of a rectangular
using the column pivoted QR decomposition. The factor matrix mode='row'
, then the input matrix is factored as
using the row pivoted QR decomposition. The factor matrix
If
[1] N. Halko, P. Martinsson, and J. Tropp. "Finding structure with randomness: probabilistic algorithms for constructing approximate matrix decompositions" (2009). (available at arXiv https://arxiv.org/abs/0909.4061).
[2] N. B. Erichson, S. Voronin, S. L. Brunton and J. N. Kutz. 2019. Randomized Matrix Decompositions Using R. Journal of Statistical Software, 89(11), 1-48. 10.18637/jss.v089.i11.
rcur
,
# NOT RUN {
# Load test image
data("tiger")
# Compute (column) randomized interpolative decompsition
# Note that the image needs to be transposed for correct plotting
out <- rid(t(tiger), k = 150)
# Show selected columns
tiger.partial <- matrix(0, 1200, 1600)
tiger.partial[,out$idx] <- t(tiger)[,out$idx]
image(t(tiger.partial), col = gray((0:255)/255), useRaster = TRUE)
# Reconstruct image
tiger.re <- t(out$C %*% out$Z)
# Compute relative error
print(norm(tiger-tiger.re, 'F') / norm(tiger, 'F'))
# Plot approximated image
image(tiger.re, col = gray((0:255)/255))
# }
Run the code above in your browser using DataLab