Skip to content

Commit b043feb

Browse files
author
studentfedorov
committed
Fixed operator -
1 parent a1a5ac1 commit b043feb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Lab8/src/matrix.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,8 @@ const Matrix Matrix::operator+(const Matrix& m) const{
9898
}
9999

100100
const Matrix Matrix::operator-(const Matrix& m) const{
101-
Matrix tmp(m);
102-
tmp -= (*this);
103-
for (size_t i = 0; i < _rows; i++)
104-
for (size_t j = 0; j < _cols; j++)
105-
tmp._data[i][j] = -tmp._data[i][j];
101+
Matrix tmp((*this));
102+
tmp -= m;
106103
return tmp;
107104
}
108105

0 commit comments

Comments
 (0)