Numpy modify ndarray diagonal
If X
is your array and c
is the factor,
X[np.diag_indices_from(X)] /= c
See diag_indices_from
in the Numpy manual.
If X
is your array and c
is the factor,
X[np.diag_indices_from(X)] /= c
See diag_indices_from
in the Numpy manual.