numpy.diag()
numpy.diag
-
numpy.diag(v, k=0)
[source] -
Extract a diagonal or construct a diagonal array.
See the more detailed documentation for
numpy.diagonal
if you use this function to extract a diagonal and wish to write to the resulting array; whether it returns a copy or a view depends on what version of numpy you are using.Parameters: v : array_like
If
v
is a 2-D array, return a copy of itsk
-th diagonal. Ifv
is a