pub fn src_error_estimate<T>(
r: &Matrix<T>,
) -> Result<SrcErrorEstimate, BackendLinalgError>where
T: MatrixTriangularSolveScalar + ComplexFloat,Expand description
Compute the Appendix C SRC error and norm estimates from an upper-triangular
QR factor R.
Provenance: the formulas are Eq. (err-est) and Eq. (norm-est) in Appendix C
of Camaño–Epperly–Tropp, arXiv:2504.06475,
cross-checked against chriscamano/RandomMPOMPS/code/tensornetwork/incrementalqr.cpp::get_error_estimate
(lines 106–119). The use of actual R plus an R† solve is an equivalent
representation derived in the audit; it is not a literal port of the
author’s inverse-R storage.
The helper explicitly builds R† before solving R† G = I, so complex
inputs use the Hermitian adjoint rather than a plain transpose. The solve is
delegated to the configured tensor4all backend and is restricted to the
small sketch matrix; no general dense inverse routine is used.
§Errors
Returns BackendLinalgError when r is empty, non-square,
non-triangular, singular, or contains non-finite values, or when the backend
triangular solve fails.
§Examples
use tensor4all_tensorbackend::{src_error_estimate, Matrix};
let r = Matrix::from_col_major_vec(2, 2, vec![2.0_f64, 0.0, 1.0, 3.0]);
let estimate = src_error_estimate(&r).unwrap();
assert!(estimate.error.is_finite());
assert!(estimate.norm.is_finite());