Skip to main content

validate_correlation_matrix

Function validate_correlation_matrix 

Source
pub fn validate_correlation_matrix(matrix: &DMatrix<f64>) -> Result<()>
Expand description

Check if a matrix is a valid correlation matrix.

A valid correlation matrix must be:

  1. Square
  2. Symmetric
  3. Have unit diagonal
  4. Be positive semi-definite

§Arguments

  • matrix - Matrix to validate

§Returns

Ok(()) if valid, error otherwise.