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

◆ trace() [3/4]

template<typename T , require_eigen_t< T > * = nullptr, require_not_st_var< T > * = nullptr>
value_type_t< T > 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 22 of file trace.hpp.