diff --git a/lab10/jacobi/matrix.h b/lab10/jacobi/matrix.h index 31bc018..7a78fd7 100644 --- a/lab10/jacobi/matrix.h +++ b/lab10/jacobi/matrix.h @@ -114,10 +114,15 @@ public: // scalar division Matrix &operator/=(double x); - std::vector &get_row(int i) { - size_t start = i * this->numCols_; - return std::vector(this->data_ + start, - this->data_ + start + this->numCols_); + std::vector get_row(int i) { + std::vector row(0); + int start = this->cols() * i; + int end = this->cols() * i + cols(); + + for (int j = start; j < end; j++) { + row.push_back(this->data()[j]); + } + return row; } private: