diff --git a/matrix.hpp b/matrix.hpp index d64c240..2016ca6 100644 --- a/matrix.hpp +++ b/matrix.hpp @@ -108,6 +108,22 @@ public: const matrix hermitian_conjugate() const { return this->transpose().conjugate(); } + const matrix I() const { + matrix m = matrix(this->num_entries, this->entry_dimension); + for (long long i = 0; i < this->num_entries; i++) { + for (long long j = 0; j < this->entry_dimension; j++) { + if (i == j) { + m[i][j] = cnumber(1, 0); + } else { + m[i][j] = 0; + } + } + } + return m; + } + const bool is_eigenvalue(cnumber z) const { + return ((*this - (this->I() * z)).determinant() == 0); + } const bool is_hermitian() const { if (this->entry_dimension != this->num_entries) return false;