Пример #1
0
// initialize the group class to have sufficient space such that the largest nodeNumber can still be stored
FAGeneral::FAGeneral(double* x,int K, double* ngroup, NumericVector xv, std::string weights, double gamma, NumericMatrix W, int mxSize, bool verb, double eps):K(K),Weights(K,vector<double>(K)),graphsize(K){
  verbose = verb;
  mxSplitSize = mxSize;
  epsilon = eps;
  
  // calculate the weights we need
  calculateSlope(x,ngroup,xv,weights,gamma,W);
  calculateWeights(x,ngroup,xv,weights,gamma,W);
  // print_weights();
  
  if (verbose){
    Rprintf("Graph Construction \n");
  }
  
  myGraph.Construct(K,Weights,epsilon);
  // myGraph.printGraph(cout);
  
  // set groups, prefuse and set events
  initializeGroups(&x[0],&ngroup[0]);
  
  initializeEvents();
  
  // print_groups();
  // print_events();
  
  run();
  
}
void BtBookshelfGroupingMenu::initMenu(bool showNoGrouping) {
    if (!groupsInitialized) initializeGroups();

    setIcon(CResMgr::mainIndex::grouping::icon());

    m_groupingActionGroup = new QActionGroup(this);
    m_groupingActionGroup->setExclusive(true);
    BT_CONNECT(m_groupingActionGroup, SIGNAL(triggered(QAction *)),
               this, SLOT(slotGroupingActionTriggered(QAction *)));

    m_groupingCatLangAction = new QAction(this);
    m_groupingCatLangAction->setCheckable(true);
    setActionRef(m_groupingCatLangAction, groupingCatLang);
    m_groupingActionGroup->addAction(m_groupingCatLangAction);
    addAction(m_groupingCatLangAction);

    m_groupingCatAction = new QAction(this);
    m_groupingCatAction->setCheckable(true);
    setActionRef(m_groupingCatAction, groupingCat);
    m_groupingActionGroup->addAction(m_groupingCatAction);
    addAction(m_groupingCatAction);

    m_groupingLangCatAction = new QAction(this);
    m_groupingLangCatAction->setCheckable(true);
    setActionRef(m_groupingLangCatAction, groupingLangCat);
    m_groupingActionGroup->addAction(m_groupingLangCatAction);
    addAction(m_groupingLangCatAction);

    m_groupingLangAction = new QAction(this);
    m_groupingLangAction->setCheckable(true);
    setActionRef(m_groupingLangAction, groupingLang);
    m_groupingActionGroup->addAction(m_groupingLangAction);
    addAction(m_groupingLangAction);

    if (showNoGrouping) {
        m_groupingNoneAction = new QAction(this);
        m_groupingNoneAction->setCheckable(true);
        setActionRef(m_groupingNoneAction, groupingNone);
        m_groupingActionGroup->addAction(m_groupingNoneAction);
        addAction(m_groupingNoneAction);
    } else {
        m_groupingNoneAction = nullptr;
    }

    retranslateUi();
}