36#include "../../Matrix.h"
56 std::vector<unsigned int> p(m, 0);
57 for(
size_t i = 0; i < m; i++) { p[i] = i; }
59 for(
size_t col = 0; col < n - 1; col++) {
60 auto maxVal = std::abs(B(col, col));
62 for(
size_t q = col; q < n; q++) {
63 if(std::abs(B(q, col)) > maxVal) {
64 maxVal = std::abs(B(q, col));
73 auto matrixSafe = B(col);
76 B.
SetRow(index, matrixSafe);
79 for(
size_t row = col + 1; row < n; row++) { B(row, col) /= B(col, col); }
81 for(
size_t i = col + 1; i < m; i++) {
82 for(
size_t j = col + 1; j < n; j++) { B(i, j) -= (B(i, col) * B(col, j)); }
std::pair< Matrix< double >, std::vector< unsigned int > > LU(const Matrix< double > &A)
Definition: LU.h:46
void SetRow(size_t index, const Matrix< T > &other)
Definition: Matrix.h:541
size_t rows() const
Definition: Matrix.h:193
size_t columns() const
Definition: Matrix.h:198