philsupertramp/game-math
Loading...
Searching...
No Matches
gaussSeidel.h
Go to the documentation of this file.
1
12#pragma once
13#include "../../Matrix.h"
14#include "../../matrix_utils.h"
15#include "LU.h"
16#include "backwardSub.h"
17#include "forwardSub.h"
18#include <vector>
19
30 auto LR = LU(A);
31
32 auto bCopy = b;
33 for(size_t i = 0; i < b.rows(); i++) { bCopy.SetRow(i, b(LR.second[i])); }
34
35 auto c = forwardSub(LR.first, bCopy);
36 return backwardSub(LR.first, c);
37}
38
std::pair< Matrix< double >, std::vector< unsigned int > > LU(const Matrix< double > &A)
Definition: LU.h:46
Matrix< double > backwardSub(const Matrix< double > &R, const Matrix< double > &b)
Definition: backwardSub.h:27
Definition: Matrix.h:42
void SetRow(size_t index, const Matrix< T > &other)
Definition: Matrix.h:541
size_t rows() const
Definition: Matrix.h:193
Matrix< double > forwardSub(const Matrix< double > &L, const Matrix< double > &b)
Definition: forwardSub.h:27
Matrix< double > gaussSeidel(const Matrix< double > &A, const Matrix< double > &b)
Definition: gaussSeidel.h:29