Unitarity check

This commit is contained in:
Micke Nordin 2022-07-19 13:46:40 +02:00
parent cdbaae1821
commit b40998f356
Signed by: micke
GPG key ID: 014B273D614BE877

View file

@ -123,7 +123,7 @@ public:
} }
return m; return m;
} }
const bool is_diagonal() { const bool is_diagonal() const {
bool result = true; bool result = true;
if (this->num_entries != this->entry_dimension) if (this->num_entries != this->entry_dimension)
return !result; return !result;
@ -135,8 +135,12 @@ public:
} }
return result; return result;
} }
// Fixme: This is very dumb const bool is_unitary() const{
const vector get_eigenvalues() { matrix m = this->hermitian_conjugate();
return (*this * m == this->I());
}
// FIXME: This is very dumb
const vector get_eigenvalues() const {
if (this->is_diagonal()) if (this->is_diagonal())
return this->get_diagonal(); return this->get_diagonal();
return vector(0); return vector(0);