improve random_kernel test
All checks were successful
Linux arm64 / Build (push) Successful in 1m25s

This commit is contained in:
2024-03-14 21:54:13 +01:00
parent 13c9bc40db
commit 2724ca173d
3 changed files with 48 additions and 11 deletions

View File

@@ -18,10 +18,7 @@ Matrix::Matrix(std::size_t a_Raws, std::size_t a_Columns, std::initializer_list<
}
Matrix Matrix::operator*(const Matrix& a_Other) const {
if (m_Columns != a_Other.m_Raws) {
std::cerr << "Mutiplication impossible car la dimensions des matrices est incompatible" << std::endl;
return {};
}
assert(m_Columns == a_Other.m_Raws);
Matrix result(m_Raws, a_Other.m_Columns);
@@ -73,6 +70,14 @@ Matrix Matrix::RawVector(std::initializer_list<Element>&& a_Elements) {
return result;
}
void Matrix::Fill(Element a_Element) {
for (std::size_t i = 0; i < m_Raws; i++) {
for (std::size_t j = 0; j < m_Columns; j++) {
at(i, j) = a_Element;
}
}
}
void Matrix::Augment(const Matrix& a_Right) {
assert(a_Right.m_Raws == m_Raws);
Matrix temp {m_Raws, m_Columns + a_Right.m_Columns};
@@ -121,8 +126,7 @@ Matrix Matrix::operator-(const Matrix& a_Other) const {
}
bool Matrix::operator==(const Matrix& a_Other) const {
if (m_Raws != a_Other.m_Raws || m_Columns != a_Other.m_Columns)
return false;
assert(m_Raws == a_Other.m_Raws && m_Columns == a_Other.m_Columns);
for (std::size_t i = 0; i < m_Raws; i++) {
for (std::size_t j = 0; j < m_Columns; j++) {