Skip to main content

src_error_estimate_general

Function src_error_estimate_general 

Source
pub fn src_error_estimate_general<T>(
    factor: &Matrix<T>,
) -> Result<SrcErrorEstimate, BackendLinalgError>
Expand description

Compute the Appendix C SRC estimates from a general square sketch factor.

This variant is equivalent to src_error_estimate but uses a general solve for factors whose columns have been restored from pivoted QR order. The matrix is a small SRC sketch factor, not a full tensor materialization.

§Errors

Returns BackendLinalgError when factor is empty, non-square, singular, contains non-finite values, or when the configured general solve fails.

§Examples

use tensor4all_tensorbackend::{src_error_estimate_general, Matrix};

let factor = Matrix::from_col_major_vec(2, 2, vec![0.0_f64, 3.0, 2.0, 1.0]);
let estimate = src_error_estimate_general(&factor).unwrap();
assert!(estimate.error.is_finite());
assert!((estimate.norm - (14.0_f64 / 2.0).sqrt()).abs() < 1.0e-12);