34 std::cout <<
"Matrix vector dimension miss match, error!\n";
39 std::cout <<
"Matrix not squared. Dimension miss match, error!\n";
43 auto x =
zeros(v, nv);
45 if(R(m - 1, n - 1) != 0) { x.SetRow(v - 1, b(v - 1) * (1 / R(m - 1, n - 1))); }
47 for(
int j = (
int)m - 2; j >= 0; j--) {
49 for(
size_t k = j + 1; k < m; k++) { s_k += (R(j, k) * x(k, 0)); }
50 for(
size_t i = 0; i < nv; ++i) { x(j, i) = (b(j, i) - s_k) / R(j, j); }
Matrix< double > backwardSub(const Matrix< double > &R, const Matrix< double > &b)
Definition: backwardSub.h:27
size_t rows() const
Definition: Matrix.h:193
size_t columns() const
Definition: Matrix.h:198
Matrix< double > zeros(size_t rows, size_t columns, size_t elements=1)