ensure_matrix_symmetry {graphicalExtremes}R Documentation

Ensure numerical matrix symmetry/zero values

Description

Ensures the symmetry of a square matrix by averaging it with its transpose. Optionally verifies that the matrix was close to symmetric before.

Makes sure zeros are "numerically zero", by truncating all small values.

Usage

ensure_matrix_symmetry(M, checkTol = Inf, alert = NULL)

truncate_zeros(M, tol = get_small_tol())

ensure_matrix_symmetry_and_truncate_zeros(
  M,
  tol = get_small_tol(),
  checkTol = Inf
)

Arguments

M

Numeric square matrix.

checkTol

Positive scalar. If the maximum absolute difference between M and t(M) is larger, show a warning.

alert

Passed to get_alert_function: NULL or TRUE to read the option value, FALSE to return a dummy function, or a function that takes an arbitrary number of strings as arguments (e.g. stop()).

tol

All entries with absolute value below this value are truncated to zero.

Value

The adjusted value of M.

See Also

Other input validation functions: checkGamma(), check_graph(), check_partial_matrix_and_graph()


[Package graphicalExtremes version 0.3.2 Index]