nuclear_norm

Function nuclear_norm 

Source
pub fn nuclear_norm<F>(
    a: &ArrayView2<'_, F>,
    workers: Option<usize>,
) -> LinalgResult<F>
where F: Float + NumAssign + Sum + One + Send + Sync + ScalarOperand + 'static,
Expand description

Compute the nuclear norm (trace norm) of a matrix.

The nuclear norm is the sum of singular values, which for symmetric matrices is the sum of absolute eigenvalues.

§Arguments

  • a - Input matrix
  • workers - Number of worker threads (None = use default)

§Returns

  • Nuclear norm of the matrix

§Examples

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

let a = array![[2.0_f64, 0.0], [0.0, 3.0]];
let norm = nuclear_norm(&a.view(), None).unwrap();
// norm should be 5.0