Mercurial > hg > octave-nkf
diff liboctave/CMatrix.cc @ 2815:33486d9e2d00
[project @ 1997-03-14 08:24:46 by jwe]
author | jwe |
---|---|
date | Fri, 14 Mar 1997 08:25:58 +0000 |
parents | 9aeba8e006a4 |
children | 92826d6e8bd9 |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -181,6 +181,25 @@ return !(*this == a); } +bool +ComplexMatrix::is_hermitian (void) const +{ + int nr = rows (); + int nc = cols (); + + if (is_square () && nr > 0) + { + for (int i = 0; i < nr; i++) + for (int j = i; j < nc; j++) + if (elem (i, j) != conj (elem (j, i))) + return false; + + return true; + } + + return false; +} + // destructive insert/delete/reorder operations ComplexMatrix&