# 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))
# }
Run the code above in your browser using DataLab