Contents
Previous
Next
Subchapters
Current Chapters->
kron
inv
trace
det
logdet
rank
cond
null
orth
pinv
cholesky
lu
svd
qr
qred
eigen
geneig
eigsym
symeig
schur
levinson
tridiag
BlockTriDiag
Parent Chapters->
Omatrix6
linear
trace
Search Tools->
contents
reference
index
search
Computing The Trace Of A Matrix
Syntax
trace(
x
)
See Also
diag
,
cond
,
det
,
cond
Description
Returns the sum of the diagonal elements of
x
, where
x
is an integer, real, complex or double-precision matrix. The return value is a scalar with the same type as
x
.
Example
x = {[1, 2, 3], [4, 5, 6], [7, 8, 9]}
trace(x)
returns
15