use rusty_compression::*;
pub fn main() {
let mut rng = rand::thread_rng();
let dimension = (500, 100);
let k = 20;
let mat = f64::random_approximate_low_rank_matrix(dimension, 1.0, 1E-10, &mut rng);
let qr = QR::<f64>::compute_from(mat.view()).expect("Could not compress the matrix.");
let qr_compressed = qr.compress(CompressionType::RANK(k)).unwrap();
let col_int_decomp = qr_compressed.column_id().unwrap();
let two_sided_int_decomp = col_int_decomp.two_sided_id().unwrap();
let mat_approx = two_sided_int_decomp.to_mat();
let rel_diff = f64::rel_diff_fro(mat.view(), mat_approx.view());
println!("The relative difference of the compressed and original matrix is {:1.2E}", rel_diff);
}