52 suanpan_assert([&] {
if(!MEAT.is_square())
throw std::logic_error(
"can only be applied to square matrix"); });
64 std::vector<uvec>
A(
S);
68 for(
auto L = MEAT.begin_col(
K); L != MEAT.end_col(
K); ++L) IDX(J++) = L.row();
69 A[
K] = IDX(sort_index(
E(IDX)));
73 uvec G = sort_index(
E);
76 std::vector<bool>
M(
S,
false);
78 uvec R(
S, fill::zeros);
87 uword IDXA = 0, IDXB =
S - 1, IDXC =
S - 1;
100 while(IDXA <
S &&
M[G(IDXA)]) ++IDXA;
114 for(
const auto& IDX :
A[R(IDXB--)])
115 if(!
M[IDX])
M[R(IDXC--) = IDX] =
true;
118 suanpan_debug(
"RCM algorithm takes {:.5E} seconds.\n", TM.toc());
132 std::vector<uvec>
A(
S);
135 A[I] = IDX(sort_index(
E(IDX)));
uvec sort_rcm(const std::vector< uvec > &, const uvec &)
Definition sort_rcm.cpp:79
std::unordered_set< T > unordered_set
Definition container.h:55
void for_each(const IT start, const IT end, F &&FN)
Definition utility.h:31
auto suanpan_assert(F &&handler)
Definition suanPan.h:339
#define suanpan_debug(...)
Definition suanPan.h:347