From cdbaae1821af4b8dec0d4b935c172b7f07b91dce Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Mon, 18 Jul 2022 23:07:58 +0200 Subject: [PATCH] Use better machinery for is_hermitian --- matrix.hpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/matrix.hpp b/matrix.hpp index e743c7b..48750ba 100644 --- a/matrix.hpp +++ b/matrix.hpp @@ -147,16 +147,7 @@ public: const bool is_hermitian() const { if (this->entry_dimension != this->num_entries) return false; - matrix m = this->hermitian_conjugate(); - bool equal = true; - for (long long i = 0; i < m.num_entries; i++) { - for (long long j = 0; j < m.entry_dimension; j++) { - if (m[i][j] != this->entries[i][j]) { - equal = false; - } - } - } - return equal; + return *this == this->hermitian_conjugate(); } friend ostream &operator<<(ostream &os, const matrix &m) { char last = '\0';