Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ trace() [4/4]

template<typename T , require_rev_matrix_t< T > * = nullptr>
auto stan::math::trace ( const T &  m)
inline

Returns the trace of the specified matrix.

The trace is defined as the sum of the elements on the diagonal. The matrix is not required to be square. Returns 0 if matrix is empty.

Template Parameters
Ttype of the elements in the matrix
Parameters
[in]mSpecified matrix.
Returns
Trace of the matrix.

Definition at line 23 of file trace.hpp.