# rcur: Randomized CUR matrix decomposition. In rsvd: Randomized Singular Value Decomposition

## Description

Randomized CUR matrix decomposition.

## Usage

 `1` ```rcur(A, k = NULL, p = 10, q = 0, idx_only = FALSE, rand = TRUE) ```

## Arguments

 `A` array_like; numeric (m, n) input matrix (or data frame). If the data contain NAs na.omit is applied. `k` integer; target rank of the low-rank approximation, i.e., the number of columns/rows to be selected. It is required that k is smaller or equal to min(m,n). `p` integer, optional; oversampling parameter (default p=10). `q` integer, optional; number of additional power iterations (default q=0). `idx_only` bool, optional; if (TRUE), only the index set `C.idx` and `R.idx` is returned, but not the matrices `C` and `R`. This is more memory efficient, when dealing with large-scale data. `rand` bool, optional; if (TRUE), a probabilistic strategy is used, otherwise a deterministic algorithm is used.

## Details

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.

## Value

`rcur` returns a list with class id containing the following components:

C

array_like;
column subset C = A[,C.idx]; (m, k) dimensional array.

R

Array_like.
row subset R = A[R.idx, ]; (k, n) dimensional array.

U

array_like;
connector matrix; (k,k) dimensional array.

C.idx

array_like;
index set of the k selected columns used to form C.

R.idx

array_like;
index set of the k selected rows used to form R.

C.scores

array_like;
scores of the selected columns.

R.scores

array_like;
scores of the selected rows.

## Author(s)

N. Benjamin Erichson, erichson@berkeley.edu

## References

•  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. doi: 10.18637/jss.v089.i11.

•  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).

`rid`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```## 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) ```