ClikaRT::ops::diagonal
function
diagonal()
Extract the offset-th diagonal between dim1 and dim2: the two source dims are removed and a trailing dim of the diagonal's length is appended (rank - 1 total). Copies into fresh storage (deliberately not a view).
Throws
ClikaRT::Error: (INVALID_ARGUMENT) whendim1/dim2collide or are out of range (code_name()carries the reason).
Returns: a new tensor of rank - 1 with the diagonal as its trailing dim.
Declared in ClikaRT/compute/ops.h, line 3139