compress.matrix: Compress a matrix using the truncated SVD

Description Usage Arguments Value Examples

View source: R/truncated-svd.R

Description

Compress a matrix using the truncated SVD. Exactly one of rank, ratio and avg.error should be specified. The compression ratio will be at least the given value, or the average error will be at most the given value. The average error is the Frobenius norm of the error divided by the square root of the number of elements in the matrix.

Usage

1
compress.matrix(mtx, rank = NA, ratio = NA, avg.error = NA)

Arguments

mtx

matrix

rank

rank of the truncated SVD

ratio

compression ratio

avg.error

average error

Value

compressed.matrix object with decomposition, rank, error, avg.error

Examples

1
2
3
compress.matrix(matrix(1:12, 4, 3), rank=2)
compress.matrix(matrix(1:12, 4, 3), ratio=1.1)
compress.matrix(matrix(1:12, 4, 3), avg.error=0.5)

awllee/SC1ExamplePackage documentation built on Sept. 1, 2021, 4:06 a.m.