Unitarity check
This commit is contained in:
parent
cdbaae1821
commit
b40998f356
1 changed files with 7 additions and 3 deletions
10
matrix.hpp
10
matrix.hpp
|
@ -123,7 +123,7 @@ public:
|
|||
}
|
||||
return m;
|
||||
}
|
||||
const bool is_diagonal() {
|
||||
const bool is_diagonal() const {
|
||||
bool result = true;
|
||||
if (this->num_entries != this->entry_dimension)
|
||||
return !result;
|
||||
|
@ -135,8 +135,12 @@ public:
|
|||
}
|
||||
return result;
|
||||
}
|
||||
// Fixme: This is very dumb
|
||||
const vector get_eigenvalues() {
|
||||
const bool is_unitary() const{
|
||||
matrix m = this->hermitian_conjugate();
|
||||
return (*this * m == this->I());
|
||||
}
|
||||
// FIXME: This is very dumb
|
||||
const vector get_eigenvalues() const {
|
||||
if (this->is_diagonal())
|
||||
return this->get_diagonal();
|
||||
return vector(0);
|
||||
|
|
Loading…
Add table
Reference in a new issue