## trace

Purpose

Deﬁnes an “abst” element which represents the sum of the diagonal elements of a square matrix variable.

Synopsis

y=trace(X);

Description

This program deﬁnes an ”abst” data of type “linear”, y, which represents the sum of the diagonal elements of the square matrix variable X.

Example

Given a matrix variable

$$X=\begin{bmatrix} x_{1} & x_{2} & x_{3}\\ x_{2} & x_{4} & x_{5}\\ x_{3} & x_{5} & x_{6}\end{bmatrix}$$

(assume that it is already deﬁned), to obtain $$y=x_{1}+x_{4}+x_{6}$$, one can type

>> y=trace(X);