Add identity matrix and check for eigenvalue

main
Micke Nordin 2 years ago
parent 909c52ecfd
commit e662c7bebd
Signed by: micke
GPG Key ID: 014B273D614BE877

@ -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;

Loading…
Cancel
Save