matrice augmenter

This commit is contained in:
2024-02-14 21:31:05 +01:00
parent cf64e4d33c
commit 8ef738db55
2 changed files with 21 additions and 0 deletions

View File

@@ -136,6 +136,25 @@ bool Matrix::IsInversed() const {
return true;
}
void Matrix::Augmenter(const Matrix& droite) {
assert(droite.m_Lignes == m_Lignes);
Matrix temp{m_Lignes, m_Colonnes + droite.m_Colonnes};
for (std::size_t i = 0; i < m_Lignes; i++) {
for (std::size_t j = 0; j < m_Colonnes; j++) {
temp.at(i, j) = at(i, j);
}
}
for (std::size_t i = 0; i < m_Lignes; i++) {
for (std::size_t j = 0; j < droite.m_Colonnes; j++) {
temp.at(i, j + m_Colonnes) = droite.at(i, j);
}
}
*this = temp;
}
bool Matrix::operator==(const Matrix& other) const {
if (m_Lignes != other.m_Lignes || m_Colonnes != other.m_Colonnes)
return false;