add basic test

This commit is contained in:
2024-02-10 16:58:44 +01:00
parent 150e67e30b
commit 4c217a4b20
4 changed files with 73 additions and 0 deletions

View File

@@ -134,6 +134,20 @@ bool Matrix::IsInversed() const {
return true;
}
bool Matrix::operator==(const Matrix& other) const {
if (m_Lignes != other.m_Lignes || m_Colonnes != other.m_Colonnes)
return false;
for (std::size_t i = 0; i < m_Lignes; i++) {
for (std::size_t j = 0; j < m_Colonnes; j++) {
if (!IsEqualZero(at(i, j) - other.at(i, j)))
return false;
}
}
return true;
}
void Matrix::GaussNonJordan(bool reduite) {
int r = -1;
for (std::size_t j = 0; j < m_Colonnes; j++) {

View File

@@ -37,6 +37,8 @@ class Matrix {
bool IsInversed() const;
bool operator==(const Matrix& other) const;
long double& operator[](std::size_t indice);
long double& at(std::size_t ligne, std::size_t colonne);