trace#
Return the trace (sum of elements on the diagonal) of a tensor
-
template<typename InputOperator>
__MATX_INLINE__ auto matx::trace(const InputOperator &a)# Computes the trace of a square matrix by summing the diagonal
- Template Parameters:
InputOperator – Input data type
- Parameters:
a – Input data to reduce
Examples#
auto t2 = make_tensor<TestType>({count, count});
auto t0 = make_tensor<TestType>({});
(t2 = ones<TestType>(t2.Shape())).run(exec);
(t0 = trace(t2)).run(exec);