fill_diagonal#
- ivy.fill_diagonal(a, v, /, *, wrap=False)[source]#
Fill the main diagonal of the given array of any dimensionality..
- Parameters:
a (
Union
[Array
,NativeArray
]) – Array at least 2D.v (
Union
[int
,float
,Array
,NativeArray
]) – Value(s) to write on the diagonal. If val is scalar, the value is written along the diagonal. If array-like, the flattened val is written along the diagonal, repeating if necessary to fill all diagonal entries.wrap (
bool
, default:False
) – The diagonal ‘wrapped’ after N columns for tall matrices.
- Return type:
Union
[Array
,NativeArray
]- Returns:
ret – Array with the diagonal filled.