correct get_row

This commit is contained in:
kai
2025-05-31 13:33:09 +02:00
parent 3b57cfa1d2
commit 8d1fbc98e8

View File

@@ -114,10 +114,15 @@ public:
// scalar division
Matrix &operator/=(double x);
std::vector<double> &get_row(int i) {
size_t start = i * this->numCols_;
return std::vector<double>(this->data_ + start,
this->data_ + start + this->numCols_);
std::vector<double> get_row(int i) {
std::vector<double> 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: