A very stupid first start of get_eigenvalues

main
Micke Nordin 2 years ago
parent 115cc01f79
commit 93caf54646
Signed by: micke
GPG Key ID: 014B273D614BE877

@ -121,6 +121,24 @@ public:
} }
return m; return m;
} }
const bool is_diagonal() {
bool result = true;
if (this->num_entries != this->entry_dimension)
return !result;
for (long long i = 0; i < this->num_entries; i++) {
for (long long j = 0; j < this->num_entries; j++) {
if (i != j && this->entries[i][j] != 0)
return !result;
}
}
return result;
}
// Fixme: This is very dumb
const vector get_eigenvalues() {
if (this->is_diagonal())
return this->get_diagonal();
return vector(0);
}
const bool is_eigenvalue(cnumber z) const { const bool is_eigenvalue(cnumber z) const {
return ((*this - (this->I() * z)).determinant() == 0); return ((*this - (this->I() * z)).determinant() == 0);
} }

Loading…
Cancel
Save