我已经看到了这个代码查找矩阵的次要:C++中的奇怪表达式 - 这是什么意思?
RegMatrix RegMatrix::Minor(const int row, const int col)const{
//printf("minor(row=%i, col=%i), rows=%i, cols=%i\n", row, col, rows, cols);
assert((row >= 0) && (row < numRow) && (col >= 0) && (col < numCol));
RegMatrix result(numRow-1,numCol-1);
// copy the content of the matrix to the minor, except the selected
for (int r = 0; r < (numRow - (row >= numRow)); r++){
for (int c = 0; c < (numCol - (col > numCol)); c++){
//printf("r=%i, c=%i, value=%f, rr=%i, cc=%i \n", r, c, p[r-1][c-1], r - (r > row), c - (c > col));
result.setElement(r - (r > row), c - (c > col),_matrix[r-1][c-1]);
}
}
return result;
}
这是第一次遇到一个代码行像这样表示:R <(numRow行 - (行> = numRow行))。
这是什么意思?
哦,我现在得到这个。 – limlim 2010-10-07 08:54:24
那么,在将值复制到矩阵中时,此代码如何“忽略”给定的行和列号?它仍然是一个神秘的代码给我... – limlim 2010-10-07 08:55:37