//chatgpt optimized submatrix to reduce branching constexpr auto submatrix(size_type remove_row, size_type remove_column) const noexcept { assert(remove_row < rows() && remove_column < columns() && "submatrix: row and column to remove must be inside the original matrix."); Matrix r; uint8_t ri = 0; for (size_type i = 0; i < rows(); i++) { if (i == remove_row) { continue; } for (size_type j = 0; j < columns(); j++) { if (j == remove_column) { continue; } r[ri++] = _data[i * columns() + j]; } } return r; }