Determine if matrix is diagonal
tf = isdiag(
returns
logical A
)1
(true
) if A
is
a diagonal matrix;
otherwise, it returns logical 0
(false
).
Use the diag
function
to produce diagonal matrices for which isdiag
returns
logical 1
(true
).
The functions isdiag
, istriu
,
and istril
are special cases of the function isbanded
, which can perform all of the
same tests with suitably defined upper and lower bandwidths. For example, isdiag(A)
== isbanded(A,0,0)
.