Пример #1
0
int main(int argc, char const *argv[])
{
   Expression_t *a = Term("a"),
              *b = Term("b"),
              *c = TermLiteral(litInt(5)),
              *plus = Plus(a,b),
              *mult = Multiply(plus, c);
   Expression_print(mult);
   append_expression(mult, plus);
   puts("");
   Expression_printList(mult);
   puts("");
   return 0;
}
Пример #2
0
//Creates a heightmap from your seed.
void MAPGEN::create(float fractalfactor, int seed){
	srand(seed);
	int w=msize,h=msize;
	int i, j, k;
	float amount = 256;//, l;

	// Do the corners
	map[0][0] = 0; //FRandom(amount);
	map[w-1][0] = 0; //FRandom(amount);
	map[w-1][h-1] = 0; //FRandom(amount);
	map[0][h-1] = 0; //FRandom(amount);
	amount /= fractalfactor;

	for (i = 128; i > 0; i /= 2){
		// This is the square phase
		for (j = i; j < w; j += 2 * i)
			for (k = i; k < h; k += 2 * i){
				map[j][k] = (map[Minus(j, i)][Minus(k, i)] +
					map[Minus(j, i)][Plus(k, i)] +
					map[Plus(j, i)][Plus(k, i)] +
					map[Plus(j, i)][Minus(k, i)]) / 4. +
					FRandom(amount);
			}
		amount /= fractalfactor;

		// This is the diamond phase
		for (j = 0; j < w; j += i)
			for (k = 0; k < h; k += i)
				if ((((j + k) / i) % 2) == 1){
					//  In this phase we might fall off the edge
					//  when we count the average of neighbours
					//  Minus and Plus take care of that
					map[j][k] = (map[Minus(j, i)][k] +
						map[j][Minus(k, i)] +
						map[Plus(j, i)][k] +
						map[j][Plus(k, i)]) / 4 +
						FRandom(amount);
				}
		amount /= fractalfactor;
	}
}
Пример #3
0
void M2MFstAligner::Sequences2FST( VectorFst<LogArc>* fst, vector<string>* seq1, vector<string>* seq2 ){
  /*
    Build an FST that represents all possible alignments between seq1 and seq2, given the 
     parameter values input by the user.  Here we encode the input and output labels, in fact
     creating a WFSA.  This simplifies the training process, but means that we can only 
     easily compute a joint maximization.  In practice joint maximization seems to give the 
     best results anyway, so it probably doesn't matter.

    Note: this also performs the initizization routine.  It performs a UNIFORM initialization
     meaning that every non-null alignment sequence is eventually initialized to 1/Num(unique_alignments).
     It might be more appropriate to consider subsequence length here, but for now we stick 
     to the m2m-aligner approach.

    TODO: Add an FST version and support for conditional maximization.  May be useful for languages
     like Japanese where there is a distinct imbalance in the seq1->seq2 length correspondences.
  */
  int istate=0; int ostate=0;
  for( unsigned int i=0; i<=seq1->size(); i++ ){
    for( unsigned int j=0; j<=seq2->size(); j++ ){
      fst->AddState();
      istate = i*(seq2->size()+1)+j;

      //Epsilon arcs for seq1
      if( seq1_del==true )
	for( unsigned int l=1; l<=seq2_max; l++ ){
	  if( j+l<=seq2->size() ){
	    vector<string> subseq2( seq2->begin()+j, seq2->begin()+j+l );
	    int is = isyms->AddSymbol(skip+s1s2_sep+vec2str(subseq2, seq2_sep));
	    ostate = i*(seq2->size()+1) + (j+l);
	    LogArc arc( is, is, 99, ostate );
	    fst->AddArc( istate, arc );
	    /*
	    if( prev_alignment_model.find(arc.ilabel)==prev_alignment_model.end() ){
	      prev_alignment_model.insert( pair<LogArc::Label,LogWeight>(arc.ilabel,arc.weight) );
	      _compute_penalties( arc.ilabel, 1, l, true, false );
	    }else{
	      prev_alignment_model[arc.ilabel] = Plus(prev_alignment_model[arc.ilabel],arc.weight);
	    }
	    total = Plus( total, arc.weight );
	    */
	  }
	}

      //Epsilon arcs for seq2
      if( seq2_del==true )
	for( unsigned int k=1; k<=seq1_max; k++ ){
	  if( i+k<=seq1->size() ){
	    vector<string> subseq1( seq1->begin()+i, seq1->begin()+i+k );
	    int is = isyms->AddSymbol(vec2str(subseq1, seq1_sep)+s1s2_sep+skip);
	    ostate = (i+k)*(seq2->size()+1) + j;
	    LogArc arc( is, is, 99, ostate );
	    fst->AddArc( istate, arc );
	    /*
	    if( prev_alignment_model.find(arc.ilabel)==prev_alignment_model.end() ){
	      prev_alignment_model.insert( pair<LogArc::Label,LogWeight>(arc.ilabel,arc.weight) );
	      _compute_penalties( arc.ilabel, k, 1, false, true );
	    }else{
	      prev_alignment_model[arc.ilabel] = Plus(prev_alignment_model[arc.ilabel],arc.weight);
	    }
	    total = Plus(total, arc.weight);
	    */
	  }
	}

      //All the other arcs
      for( unsigned int k=1; k<=seq1_max; k++ ){
	for( unsigned int l=1; l<=seq2_max; l++ ){
	  if( i+k<=seq1->size() && j+l<=seq2->size() ){
	    vector<string> subseq1( seq1->begin()+i, seq1->begin()+i+k );
	    string s1 = vec2str(subseq1, seq1_sep);
	    vector<string> subseq2( seq2->begin()+j, seq2->begin()+j+l );
	    string s2 = vec2str(subseq2, seq2_sep);
	    //This says only 1-M and N-1 allowed, no M-N links!
	    if( restrict==true && l>1 && k>1)
	      continue;
	    int is = isyms->AddSymbol(s1+s1s2_sep+s2);
	    ostate = (i+k)*(seq2->size()+1) + (j+l);
	    LogArc arc( is, is, LogWeight::One().Value()*(k+l), ostate );
	    fst->AddArc( istate, arc );
	    //During the initialization phase, just count non-eps transitions
	    //We currently initialize to uniform probability so there is also 
            // no need to tally anything here.
	    /*
	    if( prev_alignment_model.find(arc.ilabel)==prev_alignment_model.end() ){
	      prev_alignment_model.insert( pair<LogArc::Label,LogWeight>(arc.ilabel, arc.weight) );
	      _compute_penalties( arc.ilabel, k, l, false, false );
	    }else{
	      prev_alignment_model[arc.ilabel] = Plus(prev_alignment_model[arc.ilabel],arc.weight);
	    }
	    total = Plus( total, arc.weight );
	    */
	  }
	}
      }

    }
  }

  fst->SetStart(0);
  fst->SetFinal( ((seq1->size()+1)*(seq2->size()+1))-1, LogWeight::One() );
  //Unless seq1_del==true && seq2_del==true we will have unconnected states
  // thus we need to run connect to clean out these states
  if( seq1_del==false || seq2_del==false )
    Connect(fst);

  //Only add arcs that are in the FINAL fst to the model
  for( StateIterator<VectorFst<LogArc> > siter(*fst); !siter.Done(); siter.Next() ){
    LogArc::StateId q = siter.Value();
    for( ArcIterator<VectorFst<LogArc> > aiter(*fst, q); !aiter.Done(); aiter.Next() ){
      const LogArc& arc = aiter.Value();
      if( prev_alignment_model.find(arc.ilabel)==prev_alignment_model.end() ){
	prev_alignment_model.insert( pair<LogArc::Label,LogWeight>(arc.ilabel, arc.weight) );
	string sym = isyms->Find(arc.ilabel);
	size_t del = sym.find("}");
	size_t ski = sym.find("_");
	size_t chu = sym.find("|");
	int k=1; int l=1;
	bool xd = false; bool yd = false;
	if( chu!=string::npos ){
	  if( chu<del )
	    k += 1;
	  else
	    l += 1;
	}
	if( ski!=string::npos ){
	  if( ski<del )
	    xd = true;
	  else
	    yd = true;
	}
	_compute_penalties( arc.ilabel, k, l, false, false );
      }else{
	prev_alignment_model[arc.ilabel] = Plus(prev_alignment_model[arc.ilabel],arc.weight);
      }
      total = Plus( total, arc.weight );
    }
  }

  return;
}
Пример #4
0
void MAPGEN::render(){
	int w=msize,h=msize;
	ProgressIndicator myInd(20, 570, 236, 20,1);

	int startcol;

	float min = 256, max = -256, col;
	int i, j;

	myInd.set_text("Searching for min and max");
	for (i = 0; i < w; i++){
		myInd.Draw(float(i)/w);
		for (j = 0; j < h; j++){
			if (min > map[i][j]) min = map[i][j];
			if (max < map[i][j]) max = map[i][j];
		}
	}
	myInd.set_text("Rendering map");
	Wanderer *wander;
	for (i = 0; i < w; i++){
		myInd.Draw(float(i)/w);
		for (j = 0; j < h; j++){
			if(mouse_b)	return;
			wander = new Wanderer(i, j, &ljus);
			col = (map[i][j] - min)/(max - min);
			if (col > 1) col = 1;
			startcol = pal->GetColour(col);
			ColourSystem *shady = new ColourSystem(int(0.5 * getr(startcol)), 
                                                int(0.5 * getg(startcol)),
                                                int(0.5 * getb(startcol)),
						getr(startcol),
                                                getg(startcol),
                                                getb(startcol));
			shady->AddPoint(int(0.6 * getr(startcol)),
						int(0.6 * getg(startcol)),
						int(0.6 * getb(startcol)),
						int(0.4));
			shady->AddPoint(int(0.8 * getr(startcol)),
						int(0.8 * getg(startcol)),
						int(0.8 * getb(startcol)),
						int(0.6));
            
			Vektor *v = new Vektor(1, 0, map[Plus(i,1)][j]-map[i][j]);
			Vektor *u = new Vektor(0, 1, map[i][Plus(j, 1)]-map[i][j]);
			Vektor x = *v % *u;

			float facing = x ^ ljus;
			if(flags&SHADOW){
				float lightAlt = ljus.k / sqrt(ljus.i * ljus.i + ljus.j * ljus.j);
				wander->Step(); wander->Step();
				while(1){
					wander->Step();
					if (wander->steps > w)
						break;
					float deltAlt = map[wander->x & (w-1)][wander->y & (w-1)] - map[i][j];
					if (deltAlt / sqrt(pow(wander->x - i, 2) + pow(wander->y - j, 2)) > lightAlt){
						facing /= 2;
						break;
					}
				}
			}

			putpixel(cmap, i, j, shady->GetColour(facing));
			delete v;
			delete u;
			delete shady;
			delete wander;
		}
		blit(cmap, screen, i, 0, 280+i, 8, 1, h);
	}
}
Пример #5
0
qPBReaderConfigDialog::qPBReaderConfigDialog() :
   qPBReaderDialog(0, tr("qPBReader configuration"), Qt::Popup)
{
   TRSCOPE(cfg, "qPBReaderConfigDialog::qPBReaderConfigDialog");

   qPBReaderVerticalWidget * pVert = new qPBReaderVerticalWidget(this);
   addWidget(pVert);

   // ----------------------------------
   // main language
   // ----------------------------------
   {
      _pCBLang = new qPBReaderComboBox(tr("Application language"), this);
      const QStringList & lsLang = qPBReaderLangLists::GetAvailableApplicationLanguages();
      _pCBLang->_pComboBox->addItems(lsLang);
      pVert->AddWidget(_pCBLang);

      int nPos = lsLang.indexOf(qPBReaderConfig::GetApplicationLanguage());
      if (nPos < 0)
      {
         nPos = 0;
      }
      _pCBLang->_pComboBox->setCurrentIndex(nPos);


      QObject::connect(
         _pCBLang->_pComboBox, SIGNAL(currentIndexChanged(const QString &)),
         this                , SLOT  (ApplicationLanguageChanged(const QString &))
      );
   }

   // ----------------------------------
   // magnification
   // ----------------------------------

   {
      _pZoom = new qPBReaderZoomWidgetWithLabel(tr("Font size"), this);
      _pZoom->_pZoomWidget->SetValue(qPBReaderConfig::GetDefaultMagnificationFactor());
      pVert->AddWidget(_pZoom);

      QObject::connect(_pZoom->_pZoomWidget, SIGNAL(Minus()), this, SLOT(MagnificationStepMinus()));
      QObject::connect(_pZoom->_pZoomWidget, SIGNAL(Plus()),  this, SLOT(MagnificationStepPlus()));
   }

   // ----------------------------------
   // margins
   // ----------------------------------

   {
      bool bUseBookMargin = qPBReaderConfig::GetDefaultUseBookMargin();
      Qt::CheckState state = bUseBookMargin ? Qt::Checked : Qt::Unchecked;
      int top, side, bottom;
      qPBReaderConfig::GetDefaultMargins(top, side, bottom);

      // default margin
      _pUseBookMarginCheckBox = new QCheckBox(tr("Use book margin"), pVert);
      _pUseBookMarginCheckBox->setCheckState(state);
      pVert->AddWidget(_pUseBookMarginCheckBox);

      // top margin
      _pTop = new qPBReaderSetValueWidgetWithLabel(tr("Top margin"), this);
      _pTop->_pSetValueWidget->SetText(QString::number(top));
      _pTop->_pSetValueWidget->setEnabled(!bUseBookMargin);
      pVert->AddWidget(_pTop);

      // side margin
      _pSide = new qPBReaderSetValueWidgetWithLabel(tr("Side margin"), this);
      _pSide->_pSetValueWidget->SetText(QString::number(side));
      _pSide->_pSetValueWidget->setEnabled(!bUseBookMargin);
      pVert->AddWidget(_pSide);

      // bottom margin
      _pBottom = new qPBReaderSetValueWidgetWithLabel("Bottom margin", this);
      _pBottom->_pSetValueWidget->SetText(QString::number(bottom));
      _pBottom->_pSetValueWidget->setEnabled(!bUseBookMargin);
      pVert->AddWidget(_pBottom);

      QObject::connect(_pUseBookMarginCheckBox, SIGNAL(stateChanged(int)),
                       this, SLOT(UseBookMarginChanged(int)));

      QObject::connect(_pTop->_pSetValueWidget, SIGNAL(Minus()),
                       this                   , SLOT(TopMarginMinus()));
      QObject::connect(_pTop->_pSetValueWidget, SIGNAL(Plus()),
                       this                   , SLOT(TopMarginPlus()));
      QObject::connect(_pSide->_pSetValueWidget, SIGNAL(Minus()),
                       this                    , SLOT(SideMarginMinus()));
      QObject::connect(_pSide->_pSetValueWidget, SIGNAL(Plus()),
                       this                    , SLOT(SideMarginPlus()));
      QObject::connect(_pBottom->_pSetValueWidget, SIGNAL(Minus()),
                       this                      , SLOT(BottomMarginMinus()));
      QObject::connect(_pBottom->_pSetValueWidget, SIGNAL(Plus()),
                       this                      , SLOT(BottomMarginPlus()));
   }


   // ----------------------------------
   // hyphens
   // ----------------------------------

   {
      QString sHyphenPatt = qPBReaderConfig::GetDefaultHyphenPatternLang();
      bool bUseHyphens = !sHyphenPatt.isEmpty();
      Qt::CheckState state = bUseHyphens ? Qt::Checked : Qt::Unchecked;
      TRACE << VAR(bUseHyphens) << endl;
      const QStringList & lsLang = qPBReaderLangLists::GetAvailableHyphenPatterns();

      // use hyphens

      _pUseHyphens = new QCheckBox(tr("Hyphenation"), pVert);
      _pUseHyphens->setCheckState(state);
      pVert->AddWidget(_pUseHyphens);

      // hyphen lang

      _pHyphenDic = new qPBReaderComboBox(tr("Hyphen dictionary language"), this);
      _pHyphenDic->_pComboBox->addItems(lsLang);
      int nPos = lsLang.indexOf(sHyphenPatt);
      if (nPos < 0)
      {
         nPos = 9; // en-us
      }
      _pHyphenDic->_pComboBox->setCurrentIndex(nPos);
      _pHyphenDic->_pComboBox->setEnabled(bUseHyphens);
      pVert->AddWidget(_pHyphenDic);

      QObject::connect(_pUseHyphens, SIGNAL(stateChanged(int)),
                       this, SLOT(UseHyphensChanged(int)));

      QObject::connect(_pHyphenDic->_pComboBox,
                       SIGNAL(currentIndexChanged(const QString &)),
                       this, SLOT(HyphenDicChanged(const QString &)));
   }

   // ----------------------------------
   // fonts
   // ----------------------------------

   {   
      bool bIgnoreFonts = qPBReaderConfig::GetDefaultIgnoreFonts();

      // ignore book fonts

      _pIgnoreFontsCheckBox = new QCheckBox(tr("Ignore book fonts"), pVert);
      Qt::CheckState state = bIgnoreFonts ? Qt::Checked : Qt::Unchecked;
      _pIgnoreFontsCheckBox->setCheckState(state);
      pVert->AddWidget(_pIgnoreFontsCheckBox);

      // serif

      _pFonts[0] = new qPBReaderFontSelectorWidget(tr("Serif"), pVert);
      QString sSerif = qPBReaderConfig::GetDefaultSerifFont();
      _pFonts[0]->_pFontComboBox->setCurrentFont(QFont(sSerif));
      pVert->AddWidget(_pFonts[0]);

      // sans

      _pFonts[1] = new qPBReaderFontSelectorWidget(tr("Sans-serif"), pVert);
      QString sSans = qPBReaderConfig::GetDefaultSansFont();
      _pFonts[1]->_pFontComboBox->setCurrentFont(QFont(sSans));
      pVert->AddWidget(_pFonts[1]);

      // mono

      _pFonts[2] = new qPBReaderFontSelectorWidget(tr("Monospace"), pVert);
      QString sMono = qPBReaderConfig::GetDefaultMonoFont();
      _pFonts[2]->_pFontComboBox->setCurrentFont(QFont(sMono));
      pVert->AddWidget(_pFonts[2]);

      // std

      _pType = new qPBReaderTypeSelectorWidget(tr("Standard"), pVert);
      int idx = qPBReaderConfig::GetDefaultStandardFont();
      _pType->_pComboBox->setCurrentIndex(idx);
      pVert->AddWidget(_pType);



      QObject::connect(_pIgnoreFontsCheckBox, SIGNAL(stateChanged(int)),
                       this                 , SLOT(IgnoreFontsChanged(int)));

      QObject::connect(_pFonts[0]->_pFontComboBox,
                       SIGNAL(currentFontChanged(const QFont &)),
                       this, SLOT(SelectionChanged()));
      QObject::connect(_pFonts[1]->_pFontComboBox,
                       SIGNAL(currentFontChanged(const QFont &)),
                       this, SLOT(SelectionChanged()));
      QObject::connect(_pFonts[2]->_pFontComboBox,
                       SIGNAL(currentFontChanged(const QFont &)),
                       this, SLOT(SelectionChanged()));
      QObject::connect(_pType->_pComboBox, SIGNAL(currentIndexChanged(int)),
                       this, SLOT(SelectionChanged()));
   }


    QObject::connect(this, SIGNAL(finished(int)), QCoreApplication::instance(), SLOT(quit()));

}
Пример #6
0
void TVector::Resize(int delta){
	if (delta>0)
		Plus(delta);
	else if (delta<0)
		Minus(-delta);
}
Пример #7
0
 Expression< array<T,N> , Plus , array<T,N> >  operator+ ( const array<T,N>& lhs , const array<T,N>& rhs )
 {
     return  make_Expression( lhs , Plus() , rhs );
 }
Пример #8
0
 Expression< Expression<Lhs,Op,Rhs> , Plus , OtherExp >
 operator+ ( const Expression<Lhs,Op,Rhs>& lhs , const OtherExp& rhs )
 {
     return  make_Expression( lhs , Plus() , rhs );
 }
Пример #9
0
void
M2MFstAligner::Sequences2FST(VectorFst<LogArc> *fst,
                             vector<string> *seq1,
                             vector<string> *seq2)
{
    /*
       Build an FST that represents all possible alignments between seq1 and seq2, given the
       parameter values input by the user.  Here we encode the input and output labels, in fact
       creating a WFSA.  This simplifies the training process, but means that we can only
       easily compute a joint maximization.  In practice joint maximization seems to give the
       best results anyway, so it probably doesn't matter.

       Note: this also performs the initizization routine.  It performs a UNIFORM initialization
       meaning that every non-null alignment sequence is eventually initialized to 1/Num(unique_alignments).
       It might be more appropriate to consider subsequence length here, but for now we stick
       to the m2m-aligner approach.

       TODO: Add an FST version and support for conditional maximization.  May be useful for languages
       like Japanese where there is a distinct imbalance in the seq1->seq2 length correspondences.
     */
    int istate = 0;
    int ostate = 0;
    for (int i = 0; i <= seq1->size(); i++) {
        for (int j = 0; j <= seq2->size(); j++) {
            fst->AddState();
            istate = i * (seq2->size() + 1) + j;

            //Epsilon arcs for seq1
            if (seq1_del == true)
                for (int l = 1; l <= seq2_max; l++) {
                    if (j + l <= seq2->size()) {
                        vector<string> subseq2(seq2->begin() + j,
                                                  seq2->begin() + j + l);
                        int is =
                            isyms->AddSymbol(skip + s1s2_sep +
                                             vec2str(subseq2, seq2_sep));
                        ostate = i * (seq2->size() + 1) + (j + l);
                        //LogArc arc( is, is, LogWeight::One().Value()*(l+1)*2, ostate );
                        LogArc arc(is, is, 99, ostate);
                        //LogArc arc( is, is, LogWeight::Zero(), ostate );
                        fst->AddArc(istate, arc);
                        if (prev_alignment_model.find(arc.ilabel) ==
                                prev_alignment_model.end())
                            prev_alignment_model.insert(pair <
                                                        LogArc::Label,
                                                        LogWeight >
                                                        (arc.ilabel,
                                                         arc.weight));
                        else
                            prev_alignment_model[arc.ilabel] =
                                Plus(prev_alignment_model[arc.ilabel],
                                     arc.weight);
                        total = Plus(total, arc.weight);
                    }
                }

            //Epsilon arcs for seq2
            if (seq2_del == true)
                for (int k = 1; k <= seq1_max; k++) {
                    if (i + k <= seq1->size()) {
                        vector<string> subseq1(seq1->begin() + i,
                                                  seq1->begin() + i + k);
                        int is =
                            isyms->AddSymbol(vec2str(subseq1, seq1_sep) +
                                             s1s2_sep + skip);
                        ostate = (i + k) * (seq2->size() + 1) + j;
                        //LogArc arc( is, is, LogWeight::One().Value()*(k+1)*2, ostate );
                        LogArc arc(is, is, 99, ostate);
                        //LogArc arc( is, is, LogWeight::Zero(), ostate );
                        fst->AddArc(istate, arc);
                        if (prev_alignment_model.find(arc.ilabel) ==
                                prev_alignment_model.end())
                            prev_alignment_model.insert(pair <
                                                        LogArc::Label,
                                                        LogWeight >
                                                        (arc.ilabel,
                                                         arc.weight));
                        else
                            prev_alignment_model[arc.ilabel] =
                                Plus(prev_alignment_model[arc.ilabel],
                                     arc.weight);
                        total = Plus(total, arc.weight);
                    }
                }

            //All the other arcs
            for (int k = 1; k <= seq1_max; k++) {
                for (int l = 1; l <= seq2_max; l++) {
                    if (i + k <= seq1->size() && j + l <= seq2->size()) {
                        vector<string> subseq1(seq1->begin() + i,
                                                  seq1->begin() + i + k);
                        string s1 = vec2str(subseq1, seq1_sep);
                        vector<string> subseq2(seq2->begin() + j,
                                                  seq2->begin() + j + l);
                        string s2 = vec2str(subseq2, seq2_sep);
                        if (l > 1 && k > 1)
                            continue;
                        int is = isyms->AddSymbol(s1 + s1s2_sep + s2);
                        ostate = (i + k) * (seq2->size() + 1) + (j + l);
                        LogArc arc(is, is,
                                   LogWeight::One().Value() * (k + l),
                                   ostate);
                        //LogArc arc( is, is, LogWeight::One().Value(), ostate );
                        fst->AddArc(istate, arc);
                        //During the initialization phase, just count non-eps transitions
                        //We currently initialize to uniform probability so there is also
                        // no need to tally anything here.
                        if (prev_alignment_model.find(arc.ilabel) ==
                                prev_alignment_model.end())
                            prev_alignment_model.insert(pair <
                                                        LogArc::Label,
                                                        LogWeight >
                                                        (arc.ilabel,
                                                         arc.weight));
                        else
                            prev_alignment_model[arc.ilabel] =
                                Plus(prev_alignment_model[arc.ilabel],
                                     arc.weight);
                        total = Plus(total, arc.weight);
                    }
                }
            }

        }
    }

    fst->SetStart(0);
    fst->SetFinal(((seq1->size() + 1) * (seq2->size() + 1)) - 1,
                  LogWeight::One());
    //Unless seq1_del==true && seq2_del==true we will have unconnected states
    // thus we need to run connect to clean out these states
    //fst->SetInputSymbols(isyms);
    //fst->Write("right.nc.fsa");
    if (seq1_del == false or seq2_del == false)
        Connect(fst);
    //fst->Write("right.c.fsa");
    return;
}
void ON_Sum::Plus( double x, double dx )
{
  Plus(x);
  if ( ON_IsValid(dx) )
    m_sum_err += fabs(dx);
}
void ON_Sum::operator-=(double x)
{
  Plus(-x);
}
void ON_Sum::operator+=(double x)
{
  Plus(x);
}
Пример #13
0
void QtCalculator::pbplustoggled(bool myboolean){
  if(myboolean)
    Plus();
  if(pbplus->isOn() && (!key_pressed))
    pbplus->setOn(FALSE);
}