A very stupid first start of get_eigenvalues
This commit is contained in:
parent
115cc01f79
commit
93caf54646
1 changed files with 18 additions and 0 deletions
18
matrix.hpp
18
matrix.hpp
|
@ -121,6 +121,24 @@ public:
|
|||
}
|
||||
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 {
|
||||
return ((*this - (this->I() * z)).determinant() == 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue