Module total

Source
Expand description

Total least squares (errors-in-variables)

This module implements total least squares for problems where both the independent and dependent variables have measurement errors.

§Example

use ndarray::{array, Array1, Array2};
use scirs2_optimize::least_squares::total::{total_least_squares, TotalLeastSquaresOptions};

// Data points with errors in both x and y
let x_measured = array![1.0, 2.1, 2.9, 4.2, 5.0];
let y_measured = array![2.1, 3.9, 5.1, 6.8, 8.1];

// Known or estimated error variances
let x_variance = array![0.1, 0.1, 0.1, 0.2, 0.1];
let y_variance = array![0.1, 0.15, 0.1, 0.2, 0.1];

let result = total_least_squares(
    &x_measured,
    &y_measured,
    Some(&x_variance),
    Some(&y_variance),
    None
)?;

println!("Slope: {:.3}", result.slope);
println!("Intercept: {:.3}", result.intercept);

Structs§

TotalLeastSquaresOptions
Options for total least squares
TotalLeastSquaresResult
Result structure for total least squares

Enums§

TLSMethod
Methods for total least squares

Functions§

total_least_squares
Solve a total least squares problem