quemb.shared.helper.normalize_column_signs

quemb.shared.helper.normalize_column_signs(arr, epsilon=1e-05)

Divide each column by the sign of its first non-zero entry (if any).

Can be used to compare two MO matrices for (near-)equality, because it fixes the sign factor for both.

Parameters:

arr (ndarray[tuple[int, ...], dtype[floating]]) – A 2D numpy array.

Return type:

ndarray[tuple[int, ...], dtype[float64]]

Returns:

New array with columns divided by the sign of their first non-zero element.