tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
trace.h
Go to the documentation of this file.
1#ifndef FUSED_ALGORITHMS_TRACE_H
2#define FUSED_ALGORITHMS_TRACE_H
3
4#include "config.h"
6
18namespace matrix_algorithms
19{
20
29 template <typename T, my_size_t N>
31 {
32 T sum = T(0);
33
34 for (my_size_t i = 0; i < N; ++i)
35 {
36 sum += A(i, i);
37 }
38
39 return sum;
40 }
41
42} // namespace matrix_algorithms
43
44#endif // FUSED_ALGORITHMS_TRACE_H
Definition fused_matrix.h:12
Global configuration for the tesseract tensor library.
#define my_size_t
Size/index type used throughout the library.
Definition config.h:126
Definition cholesky.h:52
T trace(const FusedMatrix< T, N, N > &A)
Compute the trace of a square matrix.
Definition trace.h:30
Expr::value_type sum(const BaseExpr< Expr > &expr)
Definition reductions.h:30