cunumeric.fill_diagonal#

cunumeric.fill_diagonal(a: ndarray, val: ndarray, wrap: bool = False) None#

Fill the main diagonal of the given array of any dimensionality.

For an array a with a.ndim >= 2, the diagonal is the list of locations with indices a[i, …, i] all identical. This function modifies the input array in-place, it does not return a value.

Parameters:
  • a (array, at least 2-D.) – Array whose diagonal is to be filled, it gets modified in-place.

  • val (scalar or array_like) – 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) – If true, the diagonal “wraps” after N columns, for tall 2d matrices.

Raises:

ValueError – If the dimension of a is less than 2.

Notes

Availability:

Multiple GPUs, Multiple CPUs