ClikaRT::ops::fill_diagonal
function
fill_diagonal()
Tensor fill_diagonal(
Tensor x,
Scalar fill_value,
bool wrap = false,
StreamOrDevice s = {}
)
A copy of the 2-D matrix x with fill_value written along its diagonal.
Without wrap the diagonal stops at min(rows, cols); with wrap = true a TALL matrix continues the diagonal below the wrap row, restarting at the left edge (the classic tall-matrix wrap).
Parameters
x: the matrix; off-diagonal values carry over unchanged.fill_value: the value written on the diagonal: aScalar, kind-preserving: an integer literal writes exactly on integer dtypes (no double round-trip).wrap: tall-matrix wrap, as above. Defaultfalse.s: optional stream override. Default:x's placement.
Throws
ClikaRT::Error: (INVALID_ARGUMENT) whenxis not 2-D (code_name()carries the reason).
Returns: a new matrix, x with the diagonal overwritten.
Declared in ClikaRT/compute/ops.h, line 2268