Maths for ML / Notation

tr⁡(A)\operatorname{tr}(\mathbf{A})

trace

Linear algebraIntermediate

Say it “trace of A”

Sum of the diagonal entries of a square matrix.

Example

tr⁡[1234]=5\operatorname{tr}\begin{bmatrix}1&2\\3&4\end{bmatrix} = 5

In code

np.trace(A)
torch.trace(A)

Where you’ll see it in ML

Matrix calculus identities, Frobenius norm, KL between Gaussians.

Lessons that use it

← All 94 symbols