Use better machinery for is_hermitian

main
Micke Nordin 2 years ago
parent eeee3590c7
commit cdbaae1821
Signed by: micke
GPG Key ID: 014B273D614BE877

@ -147,16 +147,7 @@ public:
const bool is_hermitian() const { const bool is_hermitian() const {
if (this->entry_dimension != this->num_entries) if (this->entry_dimension != this->num_entries)
return false; return false;
matrix m = this->hermitian_conjugate(); return *this == 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;
} }
friend ostream &operator<<(ostream &os, const matrix &m) { friend ostream &operator<<(ostream &os, const matrix &m) {
char last = '\0'; char last = '\0';

Loading…
Cancel
Save