本文整理汇总了C++中DMat::rows方法的典型用法代码示例。如果您正苦于以下问题:C++ DMat::rows方法的具体用法?C++ DMat::rows怎么用?C++ DMat::rows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DMat
的用法示例。
在下文中一共展示了DMat::rows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lowdegreesweep
inline void lowdegreesweep(DMat& m, size_t i, DynamicVector<NodeEliminationStatus>& status) {
bool hasLowDegreeNeighbour = false;
/* Cerco vicini low-degree*/
for (size_t j = 0; j < m.rows(); ++j) {
if (j != i && status[j] == LOW_DEGREE) {
hasLowDegreeNeighbour = true;
status[i] = NOT_ELIMINATED;
break;
}
}
/* Se non aveva un vicino low_degree allora è lui il nodo low_degree!*/
if (!hasLowDegreeNeighbour) {
status[i] = LOW_DEGREE;
for (size_t j = 0; j < m.rows(); ++j) {
if (j != i)
status[j] = NOT_ELIMINATED;
}
}
}
示例2: eliminationOperators
inline void eliminationOperators(DMat& A, DynamicVector<size_t>& Cset, size_t fnode,
DynamicVector<double>& q, SpMat& P, size_t& P_col, size_t P_row) {
double scalingFactor = 1.0;
P.reserve(P_row, A.nonZeros(fnode) - 1);
DynamicVector<size_t>::Iterator ccol = Cset.begin();
for (size_t frow = 0; frow < A.rows(); ++frow) {
if (frow == fnode) { //Elemento sulla diagonale
q[P_row] = (1.0 / A(frow, fnode));
scalingFactor = -(q[P_row]);
} else if (ccol != Cset.end()) {
break; //Non ha senso andare avanti se abbiamo finito i ccol
} else if (frow == (*ccol)) {
P.append(P_row, P_col, A(frow, fnode));
P_col++;
ccol++;
}
}
P.finalize(P_row);
for (SpMat::Iterator it = P.begin(P_row); it != P.end(P_row); it++)
it->value() *= -scalingFactor;
}