我已經看到了這個代碼查找矩陣的次要: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