本文整理汇总了C++中TMatrix::at方法的典型用法代码示例。如果您正苦于以下问题:C++ TMatrix::at方法的具体用法?C++ TMatrix::at怎么用?C++ TMatrix::at使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMatrix
的用法示例。
在下文中一共展示了TMatrix::at方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findMinInCol
double CTSPSolver::findMinInCol(int nCol, const TMatrix &matrix, int exr) const
{
double min = INFINITY;
for (int k = 0; k < nCities; k++)
if ((k != exr) && (min > matrix.at(k).at(nCol)))
min = matrix.at(k).at(nCol);
return (min == INFINITY) ? 0 : min;
}
示例2: findMinInRow
double CTSPSolver::findMinInRow(int nRow, const TMatrix &matrix, int exc) const
{
double min = INFINITY;
for (int k = 0; k < nCities; k++) {
if (((k != exc)) && (min > matrix.at(nRow).at(k)))
min = matrix.at(nRow).at(k);
}
return (min == INFINITY) ? 0 : min;
}
示例3: normalize
void CTSPSolver::normalize(TMatrix &matrix) const
{
for (int r = 0; r < nCities; r++)
for (int c = 0; c < nCities; c++)
if ((r != c) && (matrix.at(r).at(c) == INFINITY))
matrix[r][c] = MAX_DOUBLE;
}
示例4: findMinInRow
// nRow: The row number
// matrix: The cost matrix
// exc: column to exclude from the min calculation
double CTSPSolver::findMinInRow(int nRow, const TMatrix &matrix, int exc) const {
double total_min = INFINITY;
#pragma omp parallel num_threads(numThreads)
{
double min = INFINITY;
#pragma omp for
for (int k = 0; k < nCities; k++) {
if (((k != exc)) && (min > matrix.at(nRow).at(k))) {
min = matrix.at(nRow).at(k);
}
}
#pragma omp critical
total_min = fmin(min, total_min);
}
return (total_min == INFINITY) ? 0 : total_min;
}