use rstest::rstest; use arr_rs::prelude::*; #[rstest( array, expected, case(array_arange!(f64, 1., 4.).reshape(&[2, 2]), Ok(vec![( array!(f64, [[0.31622776601683794, 0.9486832980505142], [0.9486832980505138, -0.3162277660168369]]).unwrap(), array!(f64, [[3.162277660168379, 4.427188724235731], [3.552713678800501e-15, 0.6324555320336809]]).unwrap(), )])), case(array_arange!(f64, 1., 9.).reshape(&[3, 3]), Ok(vec![( array!(f64, [[0.12309149097933272, 0.9045340337332908, 0.1111111111111111], [0.4923659639173309, 0.30151134457776335, 0.4444444444444444], [0.8616404368553291, -0.30151134457776435, 0.8888888888888888]]).unwrap(), array!(f64, [[8.12403840463596, 9.601136296387953, 11.078234188139945], [-6.494804694057166e-15, 0.9045340337332837, 1.809068067466573], [8.11111111111111, 9.555555555555555, 11.0]]).unwrap(), )])), case(array!(f64, [[12., -51., 4.], [6., 167., -68.], [-4., 24., -41.]]), Ok(vec![( array!(f64, [[0.8571428571428571, -0.3942857142857143, -0.33142857142857146], [0.42857142857142855, 0.9028571428571428, 0.034285714285714364], [-0.2857142857142857, 0.17142857142857143, -0.9428571428571428]]).unwrap(), array!(f64, [[13.999999999999998, 20.999999999999993, -13.999999999999998], [-2.220446049250313e-16, 175.0, -70.0], [0.0, 1.5987211554602254e-14, 34.99999999999999]]).unwrap(), )])), )] fn test_linalg_qr(array: Result, ArrayError>, expected: LinalgResult) { assert_eq!(expected, array.qr()) }