diff -uprN SymPol-0.1.9/sympol/symmetrygroupconstruction/graphconstructionbliss.cpp SymPol-0.1.9-patch/sympol/symmetrygroupconstruction/graphconstructionbliss.cpp --- SymPol-0.1.9/sympol/symmetrygroupconstruction/graphconstructionbliss.cpp 2016-05-09 03:52:35.000000000 +0800 +++ SymPol-0.1.9-patch/sympol/symmetrygroupconstruction/graphconstructionbliss.cpp 2021-10-12 00:50:30.823315747 +0800 @@ -16,35 +16,6 @@ using namespace permlib; static LoggerPtr logger(Logger::getLogger("SymGraphB ")); -/// data structure used for the bliss callback -struct BlissData { - unsigned int T; - std::list generators; -}; - - -/// bliss callback for graph automorphism generators -static -void blisshook( - void* user_param, - unsigned int n, - const unsigned int* aut - ) -{ - BOOST_ASSERT( user_param != 0 ); - BlissData* bliss = reinterpret_cast(user_param); - - BOOST_ASSERT( n % bliss->T == 0 ); - Permutation::perm proj(n / bliss->T); - for (unsigned int i = 0; i < proj.size(); ++i) { - proj[i] = aut[i]; - BOOST_ASSERT( aut[i] < proj.size() ); - } - Permutation::ptr p(new Permutation(proj)); - bliss->generators.push_back(p); -} - - boost::shared_ptr GraphConstructionBliss::compute(const MatrixConstruction* matrix) const { const unsigned int T = static_cast(std::ceil( log2((double) matrix->k() + 1.0) )); const unsigned int matrixRows = matrix->dimension(); @@ -71,14 +42,29 @@ boost::shared_ptr generators; + + /// bliss callback for graph automorphism generators + auto blisshook = [T, &generators]( + unsigned int n, + const unsigned int* aut + ) + { + BOOST_ASSERT( n % T == 0 ); + Permutation::perm proj(n / T); + for (unsigned int i = 0; i < proj.size(); ++i) { + proj[i] = aut[i]; + BOOST_ASSERT( aut[i] < proj.size() ); + } + Permutation::ptr p(new Permutation(proj)); + generators.push_back(p); + }; /* Prefer splitting partition cells corresponding to nodes with color 0 or 1, * so that we obtain a group basis beginning with them. */ G.set_splitting_heuristic(bliss::Graph::shs_f); // disable component recursion as advised by Tommi Junttila from bliss G.set_component_recursion(false); - G.find_automorphisms(stats, blisshook, &data); + G.find_automorphisms(stats, blisshook); if (yal::DEBUG <= yal::ReportLevel::get()) stats.print(stdout); else @@ -103,12 +89,12 @@ boost::shared_ptr bsgsSetup(matrixRows); boost::shared_ptr group(new PermutationGroup( - bsgsSetup.construct(data.generators.begin(), data.generators.end(), baseVars.begin(), baseVars.end()) + bsgsSetup.construct(generators.begin(), generators.end(), baseVars.begin(), baseVars.end()) )); #else SchreierSimsConstruction bsgsSetup(matrixRows); boost::shared_ptr group(new PermutationGroup( - bsgsSetup.construct(data.generators.begin(), data.generators.end()) + bsgsSetup.construct(generators.begin(), generators.end()) )); #endif