tikhonov_regularization

Function tikhonov_regularization 

Source
pub fn tikhonov_regularization<F>(
    a: &ArrayView2<'_, F>,
    lambda: F,
    identity_like: bool,
) -> LinalgResult<Array2<F>>
where F: Float + NumAssign + Sum + One + Send + Sync + ScalarOperand + 'static,
Expand description

Compute Tikhonov regularization of a matrix.

Tikhonov regularization adds a ridge term to improve conditioning: A_reg = A + λI

§Arguments

  • a - Input matrix
  • lambda - Regularization parameter
  • identity_like - Whether to add λI (true) or λ times identity-like term

§Returns

  • Regularized matrix

§Examples

use scirs2_core::ndarray::array;
use scirs2_linalg::matrix_functions::tikhonov_regularization;

let a = array![[1.0_f64, 0.5], [0.5, 1.0]];
let reg_a = tikhonov_regularization(&a.view(), 0.1, true).unwrap();