• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ring函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ring函数的典型用法代码示例。如果您正苦于以下问题:C++ ring函数的具体用法?C++ ring怎么用?C++ ring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ring

void SMat<CoeffRing>::vec_set_entry(sparsevec *&v,
                                    size_t r,
                                    const elem &a) const
{
  sparsevec *p;
  bool iszero = ring().is_zero(a);
  sparsevec head;
  head.next = v;
  for (p = &head; p->next != 0; p = p->next)
    if (p->next->row <= r) break;

  if (p->next == 0 || p->next->row < r)
    {
      if (iszero) return;
      sparsevec *w = vec_new();
      w->next = p->next;
      w->row = r;
      ring().init_set(w->coeff, a);
      p->next = w;
    }
  else if (p->next->row == r)
    {
      if (iszero)
        {
          // delete node
          sparsevec *tmp = p->next;
          p->next = tmp->next;
          vec_remove_node(tmp);
        }
      else
        ring().set(p->next->coeff, a);
    }
  v = head.next;
}
开发者ID:BertiniM2,项目名称:M2,代码行数:34,代码来源:smat.hpp


示例2: monoid

// processMonomialProduct
//     m is a monomial, component is ignored (it determined the possible n's
//     being used here)
//     n is a monomial at level 'mThisLevel-1'
//     compute their product, and return the column index of this product
//       or -1, if the monomial is not needed.
//     additionally: the product monomial is inserted into the hash table
//     and column array (if it is not already there).
// caveats: this function is only to be used during construction
//     of the coeff matrices.  It uses mThisLevel.
//
// If the ring has skew commuting variables, then result_sign_if_skew is set to
// 0, 1, or -1.
ComponentIndex F4Res::processMonomialProduct(res_const_packed_monomial m,
                                             res_const_packed_monomial n,
                                             int& result_sign_if_skew)
{
  result_sign_if_skew = 1;
  auto x = monoid().get_component(n);
  auto& p = mFrame.level(mThisLevel - 2)[x];
  if (p.mBegin == p.mEnd) return -1;

  int* thisMonom = mMonomSpace2.allocate(1 + monoid().max_monomial_size());
  thisMonom++; // so thisMonom[-1] exists, but is not part of the monomial, as far as
  monoid().unchecked_mult(m, n, thisMonom);
  monoid().set_component(x, thisMonom);

  if (ring().isSkewCommutative())
    {
      result_sign_if_skew = monoid().skew_mult_sign(ring().skewInfo(), m, n);
      if (result_sign_if_skew == 0)
        {
          mMonomSpace2.popLastAlloc(thisMonom-1); // we did not need this monomial!
          return -1;
        }
    }
  return processCurrentMonomial(thisMonom);
}
开发者ID:DanGrayson,项目名称:M2,代码行数:38,代码来源:res-f4.cpp


示例3: ring

void SMat<CoeffRing>::vec_row_op2(sparsevec *&v,
                   size_t r1, size_t r2,
                   const elem &a1, const elem &a2,
                   const elem &b1, const elem &b2) const
    // row(r1 in v) := a1 * row(r1 in v) + a2 * row(r2 in v)
    // row(r2 in v) := b1 * row(r1 in v) + b2 * row(r2 in v) (RHS refers to previous values)
{
  // v[row r1] = a1 * v[r1] + a2 * v[r2]
  // v[row r2] = b1 * v[r1] + b2 * v[r2]
  elem e1,e2, c1,c2,c3,c4;

  ring().set_zero(c1);
  ring().set_zero(c2);
  ring().set_zero(c3);
  ring().set_zero(c4);
  bool r1_nonzero = vec_get_entry(v,r1,e1);
  bool r2_nonzero = vec_get_entry(v,r2,e2);
  if (!r1_nonzero && !r2_nonzero) return;

  if (r1_nonzero)
    {
      ring().mult(c1, a1, e1);
      ring().mult(c3, b1, e1);
    }
  if (r2_nonzero)
    {
      ring().mult(c2,a2,e2);
      ring().mult(c4,b2,e2);
    }

  ring().add(c1,c1,c2);
  ring().add(c3,c3,c4);
  vec_set_entry(v,r1,c1);
  vec_set_entry(v,r2,c3);
}
开发者ID:ChristineJost,项目名称:M2,代码行数:35,代码来源:smat.cpp


示例4: print_sr

char *
print_sr(struct tr_ri *rh)
{
	int hops, ii;
	static char line[512];

	sprintf(line, "TR Source Route dir=%d, mtu=%d",
	    rh->dir, Mtutab[rh->mtu]);

	hops = (int)(rh->len - 2) / (int)2;

	if (hops) {
		sprintf(line+strlen(line), ", Route: ");
		for (ii = 0; ii < hops; ii++) {
			if (! bridge(rh->rd[ii])) {
				sprintf(line+strlen(line), "(%d)",
				    ring(rh->rd[ii]));
			} else {
				sprintf(line+strlen(line), "(%d)%d",
				    ring(rh->rd[ii]), bridge(rh->rd[ii]));
			}
		}
	}
	return (&line[0]);
}
开发者ID:FilipinOTech,项目名称:illumos-gate,代码行数:25,代码来源:snoop_ether.c


示例5: main_loop

int main_loop() 
{	
	if( arm_main_timers() == -1) {
		wrn_print("failed to arm ring timers");
		terminate();
	}

	if(arm_24h_sig() == -1) {                                  
		wrn_print("failed to arm 24h \"killer timer\"");
		terminate();
	}	
	sigset_t set;
	
	if(sigfillset(&set) == -1 ) {
		err_print ("sigwaitinfo");
		return -1;
	}
	siginfo_t info;
	char *custom_dur;

	for( ;; ) {	
		int sig = sigwaitinfo(&set, &info);

		dbg_print("FETCHED %s SIGNAL(%ld)",strsignal(sig),(long)sig);

		if(IS_EXIT_SIG(sig)) {
			dbg_print("%s SIGNAL(%ld) - exit sig; exiting", strsignal(sig),(long)sig);
			exit(EXIT_SUCCESS);
		}
		
		if(sig == SIG_RING_CUSTOM) {
			custom_dur = get_duration(&info);
			ring(custom_dur);
			continue;
		}
		switch(sig) {
		case -1:
			if(errno != EAGAIN) {
				err_print("sigwaitinfo");		
				break;
			}
		case SIG_REXEC:
			rexec();
			break;	

		case SIG_RING_SHORT:
			ring(cmd.short_ring);
			break;
		case SIG_RING_LONG:
			ring(cmd.long_ring);
			break;


		case SIGCHLD:
			zombie_assasin();
			break;
		}
	}	
}
开发者ID:Arseny-N,项目名称:bell_415,代码行数:59,代码来源:main.c


示例6: monomial

long SchreyerFrame::computeIdealQuotient(int lev, long begin, long elem)
{
  ///  std::cout << "computeIdealQuotient(" << lev << "," << begin << "," << elem << ")" << std::endl;
  // Returns the number of elements added
  res_packed_monomial m = monomial(lev, elem); 
  std::vector<PreElement*> elements;
  if (ring().isSkewCommutative())
    {
      auto skewvars = new int[ring().monoid().n_vars()];
      int a = ring().monoid().skew_vars(ring().skewInfo(), m, skewvars);
      // std::cout << "adding " << a << " syz from skew" << std::endl;
      for (int i=0; i<a; ++i)
        {
          PreElement* vp = mPreElements.allocate();
          vp->vp = mVarpowers.reserve(mMaxVPSize);
          monoid().variable_as_vp(skewvars[i], vp->vp); 
          vp->degree = monoid().degree_of_vp(vp->vp);         
          int len = static_cast<int>(res_varpower_monomials::length(vp->vp));
          mVarpowers.intern(len);

          elements.push_back(vp);
        }
      delete [] skewvars;
    }
  for (long i=begin; i<elem; i++)
    elements.push_back(createQuotientElement(monomial(lev,i), m));
  typedef ResF4MonomialLookupTableT<int32_t> MonomialLookupTable;
  MonomialLookupTable montab(monoid().n_vars());

#if 0
  std::cout << "  #pre elements = " << elements.size() << std::endl;
  for (auto i=elements.begin(); i != elements.end(); ++i)
    {
      varpower_monomials::elem_text_out(stdout, (*i)->vp);
      fprintf(stdout, "\n");
    }
#endif
  PreElementSorter C;
  std::stable_sort(elements.begin(), elements.end(), C);

  long n_elems = 0;
  for (auto i = elements.begin(); i != elements.end(); ++i)
    {
      int32_t not_used;
      bool inideal = montab.find_one_divisor_vp(0, (*i)->vp, not_used);
      if (inideal) continue;
      // Now we create a res_packed_monomial, and insert it into 'lev+1'
      montab.insert_minimal_vp(0, (*i)->vp, 0);
      res_packed_monomial monom = monomialBlock().allocate(monoid().max_monomial_size());
      monoid().from_varpower_monomial((*i)->vp, elem, monom);
      // Now insert it into the frame
      insertBasic(currentLevel(), monom, (*i)->degree + degree(currentLevel()-1, monoid().get_component(monom)));
      n_elems++;
    }
  //std::cout << "  returns " << n_elems << std::endl;
  return n_elems;
}
开发者ID:pzinn,项目名称:M2,代码行数:57,代码来源:res-schreyer-frame.cpp


示例7: QObject

AtCommands::AtCommands( AtFrontEnd *frontEnd, AtSessionManager *manager )
    : QObject( frontEnd )
{
    qLog(ModemEmulator) << "AT command session started";

    atFrontEnd = frontEnd;
    atManager = manager;

    m_atgnc = new AtGsmNonCellCommands( this );
#ifdef QTOPIA_CELL
    m_atgcc = new AtGsmCellCommands( this );
#endif
#ifdef ATINTERFACE_SMS
    m_atsms = new AtSmsCommands( this );
#endif
#ifdef QTOPIA_BLUETOOTH
    m_atbtc = new AtBluetoothCommands( this );
#endif
    m_atv250c = new AtV250Commands( this );

    // network registration for ATD()
    dataCallRequested = false;

    cmdsPosn = 0;
    result = QAtResult::OK;
    extendedError = QAtResult::OK;

    connect( frontEnd, SIGNAL(commands(QStringList)),
             this, SLOT(commands(QStringList)) );

    AtCallManager *calls = manager->callManager();
    connect( calls, SIGNAL(stateChanged(int,AtCallManager::CallState,QString,QString)),
             this, SLOT(stateChanged(int,AtCallManager::CallState,QString,QString)) );
    connect( calls, SIGNAL(deferredResult(AtCommands*,QAtResult::ResultCode)),
             this, SLOT(deferredResult(AtCommands*,QAtResult::ResultCode)) );
    connect( calls, SIGNAL(ring(QString,QString)),
             this, SLOT(ring(QString,QString)) );
    connect( calls, SIGNAL(dialingOut(bool,bool,bool)),
             this, SLOT(dialingOut(bool,bool,bool)) );
    connect( calls, SIGNAL(outgoingConnected(QString)),
             this, SLOT(outgoingConnected(QString)) );
    connect( calls, SIGNAL(callWaiting(QString,QString)),
             this, SLOT(callWaiting(QString,QString)) );
    connect( calls, SIGNAL(noCarrier()), this, SLOT(noCarrier()) );

    // register those AT commands that this class defines.
    add( "D",        this, SLOT(atd(QString)) );
    add( "+CDIS",    this, SLOT(notAllowed()) );
    add( "+CFUN",    this, SLOT(atcfun(QString)) );
    add( "+CIMI",    this, SLOT(atcimi(QString)) );
    add( "+CMAR",    this, SLOT(ignore()) );
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:52,代码来源:atcommands.cpp


示例8: hasThreePrimeDifferences

static bool hasThreePrimeDifferences(qint64 n, Primes *primes) {
    Q_ASSERT(n > 7);

    qint64 maxDiff = (ring(n))*6 + (ring(n)+1)*6 - 1; // exact

    updatePrimes(maxDiff, primes);

    const QSet<qint64> b = neighbors(n);
    int primeCount = 0;
    foreach(qint64 i, b) {
        qint64 diff = llabs(i - n);
        Q_ASSERT(diff <= maxDiff);
        primeCount += isPrime(diff, *primes) == true ? 1 : 0;
    }
开发者ID:hydroo,项目名称:coding-and-math-exercises,代码行数:14,代码来源:main.cpp


示例9: ring

void F4Res::loadRow(Row& r)
{
  //  std::cout << "loadRow: ";
  //  monoid().showAlpha(r.mLeadTerm);
  //  std::cout << std::endl;
  int skew_sign; // will be set to 1, unless ring().isSkewCommutative() is true, then it can be -1,0,1.
  // however, if it is 0, then "val" below will also be -1.
  FieldElement one;
  resGausser().set_one(one);
  long comp = monoid().get_component(r.mLeadTerm);
  auto& thiselement = mFrame.level(mThisLevel-1)[comp];
  //std::cout << "  comp=" << comp << " mDegree=" << thiselement.mDegree << " mThisDegree=" << mThisDegree << std::endl;
  if (thiselement.mDegree == mThisDegree)
    {
      // We only need to add in the current monomial
      //fprintf(stdout, "USING degree 0 monomial\n");
      ComponentIndex val = processMonomialProduct(r.mLeadTerm, thiselement.mMonom, skew_sign);
      if (val < 0) fprintf(stderr, "ERROR: expected monomial to live\n");
      r.mComponents.push_back(val);
      if (skew_sign > 0)
        r.mCoeffs.push_back(one);
      else
        {
          // Only happens if we are in a skew commuting ring.
          FieldElement c;
          ring().resGausser().negate(one, c);
          r.mCoeffs.push_back(c);
        }
      return;
    }
  auto& p = thiselement.mSyzygy;
  auto end = poly_iter(mRing, p, 1);
  auto i = poly_iter(mRing, p);
  for ( ; i != end; ++i)
    {
      ComponentIndex val = processMonomialProduct(r.mLeadTerm, i.monomial(), skew_sign);
      //std::cout << "  monom: " << val << " skewsign=" << skew_sign << " mColumns.size=" << mColumns.size() << std::endl;
      if (val < 0) continue;
      r.mComponents.push_back(val);
      if (skew_sign > 0)
        r.mCoeffs.push_back(i.coefficient());
      else
        {
          // Only happens if we are in a skew commuting ring.
          FieldElement c;
          ring().resGausser().negate(i.coefficient(), c);
          r.mCoeffs.push_back(c);
        }
    }
} 
开发者ID:gblanco92,项目名称:M2,代码行数:50,代码来源:res-f4.cpp


示例10: IM2_RingElement_to_BigComplex

gmp_CCorNull IM2_RingElement_to_BigComplex(const RingElement *a)
{
  const Ring *R = a->get_ring();
  auto RCCC = dynamic_cast<const M2::ConcreteRing<M2::ARingCCC> *>(R);
  if (RCCC != 0)
    {
      M2::ARingCCC::ElementType b;
      RCCC->ring().init(b);
      RCCC->ring().from_ring_elem(b, a->get_value());
      gmp_CC result = RCCC->ring().toBigComplex(b);
      RCCC->ring().clear(b);
      return result;
    }
  auto RCC = dynamic_cast<const M2::ConcreteRing<M2::ARingCC> *>(R);
  if (RCC != 0)
    {
      M2::ARingCC::ElementType b;
      RCC->ring().init(b);
      RCC->ring().from_ring_elem(b, a->get_value());
      gmp_CC result = RCC->ring().toBigComplex(b);
      RCC->ring().clear(b);
      return result;
    }
  ERROR("expected an element of CCC");
  return 0;
}
开发者ID:b-stone,项目名称:M2,代码行数:26,代码来源:x-relem.cpp


示例11: ring

size_t SigPolyBasis::minimalLeadInSigSlow(ConstMonoRef sig) const {
  monomial multiplier = ring().allocMonomial();
  monomial minLead = ring().allocMonomial();

  size_t minLeadGen = static_cast<size_t>(-1);
  const auto sigComponent = monoid().component(sig);
  const size_t genCount = size();
  for (size_t gen = 0; gen < genCount; ++gen) {
    if (monoid().component(signature(gen)) != sigComponent)
      continue;
    if (!monoid().divides(signature(gen), sig))
      continue;
    monoid().divide(signature(gen), sig, multiplier);
    if (minLeadGen != static_cast<size_t>(-1)) {
      auto genLead = leadMono(gen);
      const auto leadCmp = monoid().compare(minLead, multiplier, genLead);
      if (leadCmp == Monoid::LessThan)
        continue;
      if (leadCmp == Monoid::EqualTo) {
        // If same lead monomial in signature, pick the one with fewer terms
        // as that one might be less effort to reduce.
        const size_t minTerms = poly(minLeadGen).termCount();
        const size_t terms = poly(gen).termCount();
        if (minTerms > terms)
          continue;
        if (minTerms == terms) {
          // If same number of terms, pick the one with larger signature
          // before being multiplied into the same signature. That one
          // might be more reduced as the constraint on regular reduction
          // is less.
          const auto minSig = signature(minLeadGen);
          const auto genSig = signature(gen);
          const auto sigCmp = monoid().compare(minSig, genSig);

          // no two generators have same signature
          MATHICGB_ASSERT(sigCmp != Monoid::EqualTo);
          if (sigCmp == GT)
            continue;
        }
      }
    }

    minLeadGen = gen;
    monoid().multiply(multiplier, leadMono(gen), minLead);
  }
  ring().freeMonomial(multiplier);
  ring().freeMonomial(minLead);
  return minLeadGen;
}
开发者ID:Macaulay2,项目名称:mathicgb,代码行数:49,代码来源:SigPolyBasis.cpp


示例12: main

int main()
{
	int i,j;
	printf("\nEnter no. of process::");
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		printf("\nEnter Process %d is Alive or not(0/1)::",i);
		scanf("%d",&list[i]);
		if(list[i])
			cdr=i;
	}
	display();
	do
	{
		printf("\n1.BULLY ALGORITHM \n2.RING ALGORITHM\n3.Display\n4.EXIT\nEnter your choice::");
		scanf("%d",&j);
		switch(j)
		{
			case 1:
				bully();
				break;
			case 2:
				ring();
			case 3:
				display();
				break;
			case 4:
				exit(1);
		}
	}while(j!=4);
	return 0;

}
开发者ID:LakshmiPraneetha,项目名称:Learning-Stairs,代码行数:34,代码来源:Ring+and+Bully+Algorithm.c


示例13: extrude

PolyhedralSurface* extrude( const LineString& g, const Kernel::Vector_3& v )
{

    std::auto_ptr< PolyhedralSurface > polyhedralSurface( new PolyhedralSurface() );

    if ( g.isEmpty() ) {
        return polyhedralSurface.release();
    }

    for ( size_t i = 0; i < g.numPoints() - 1; i++ ) {
        std::auto_ptr< LineString > ring( new LineString ) ;

        Kernel::Point_3 a = g.pointN( i ).toPoint_3() ;
        Kernel::Point_3 b = g.pointN( i+1 ).toPoint_3() ;
        ring->addPoint( new Point( a ) );
        ring->addPoint( new Point( b ) );
        ring->addPoint( new Point( b + v ) );
        ring->addPoint( new Point( a + v ) );
        ring->addPoint( new Point( a ) );

        polyhedralSurface->addPolygon( new Polygon( ring.release() ) );
    }

    return polyhedralSurface.release() ;
}
开发者ID:giohappy,项目名称:SFCGAL,代码行数:25,代码来源:extrude.cpp


示例14: neighbors

static QSet<qint64> neighbors(qint64 n) {
    Q_ASSERT(n > 7);

    QSet<qint64> b;

    int r  = ring(n);
    qint64 p  = positionInRing(n);

    int corner = p / r; // 0 = top, counterclockwise
    qint64 offsetFromCorner = p % r; //counterclockwise

    qint64 o = ringOffset(r+1) + 2 + corner*(r+1) + offsetFromCorner; // outer neighbor
    qint64 i = ringOffset(r-1) + 2 + corner*(r-1) + offsetFromCorner; // inner neighbor

    if (p == 0) { // top corner
        b.insert(          o          );
        b.insert(          o + 1      );
        b.insert(modInRing(o - 1, r+1));
        b.insert(modInRing(n - 1, r  ));
        b.insert(          i          );
        //b.insert(n + 1); // diff = 1 -> not prime
    } else if (p == r*6 - 1) { // right to the top corner
        b.insert(          o          );
        b.insert(          o + 1      );
        b.insert(          i - 1      );
        b.insert(modInRing(n + 1, r  ));
        b.insert(modInRing(i    , r-1));
        //b.insert(n - 1); // diff = 1 -> not prime
    }

    return b;
}
开发者ID:hydroo,项目名称:coding-and-math-exercises,代码行数:32,代码来源:main.cpp


示例15: MATHICGB_ASSERT

void F4Reducer::classicReducePolySet(
  const std::vector< std::unique_ptr<Poly> >& polys,
  const PolyBasis& basis,
  std::vector< std::unique_ptr<Poly> >& reducedOut
) {
  if (polys.size() <= 1) {
    if (tracingLevel >= 2)
      std::cerr << "F4Reducer: Using fall-back reducer for "
                << polys.size() << " polynomials.\n";
    mFallback->classicReducePolySet(polys, basis, reducedOut);
    return;
  }

  reducedOut.clear();

  MATHICGB_ASSERT(!polys.empty());
  if (tracingLevel >= 2)
    std::cerr << "F4Reducer: Reducing " << polys.size() << " polynomials.\n";

  SparseMatrix reduced;
  QuadMatrix::Monomials monomials;
  {
    QuadMatrix qm(ring());
    {
      if (mType == OldType) {
        F4MatrixBuilder builder(basis, mMemoryQuantum);
        for (const auto& poly : polys)
          builder.addPolynomialToMatrix(*poly);
        builder.buildMatrixAndClear(qm);
      } else {
        F4MatrixBuilder2 builder(basis, mMemoryQuantum);
        for (const auto& poly : polys)
          builder.addPolynomialToMatrix(*poly);
        builder.buildMatrixAndClear(qm);
      }
    }
    MATHICGB_LOG_INCREMENT_BY(F4MatrixRows, qm.rowCount());
    MATHICGB_LOG_INCREMENT_BY(F4MatrixTopRows, qm.topLeft.rowCount());
    MATHICGB_LOG_INCREMENT_BY(F4MatrixBottomRows, qm.bottomLeft.rowCount());
    MATHICGB_LOG_INCREMENT_BY(F4MatrixEntries, qm.entryCount());
    saveMatrix(qm);
    reduced = F4MatrixReducer(basis.ring().charac()).
      reducedRowEchelonFormBottomRight(qm);
    monomials = std::move(qm.rightColumnMonomials);
    for (auto& mono : qm.leftColumnMonomials)
      monoid().freeRaw(mono.castAwayConst());
  }

  if (tracingLevel >= 2 && false)
    std::cerr << "F4Reducer: Extracted " << reduced.rowCount()
              << " non-zero rows\n";

  for (SparseMatrix::RowIndex row = 0; row < reduced.rowCount(); ++row) {
    auto p = make_unique<Poly>(basis.ring());
    reduced.rowToPolynomial(row, monomials, *p);
    reducedOut.push_back(std::move(p));
  }
  for (auto& mono : monomials)
    monoid().freeRaw(mono.castAwayConst());
}
开发者ID:Macaulay2,项目名称:mathicgb,代码行数:60,代码来源:F4Reducer.cpp


示例16: cursorRings

void CachedNode::cursorRings(const CachedFrame* frame,
    WTF::Vector<WebCore::IntRect>* rings) const
{
    rings->clear();
    for (unsigned index = 0; index < mCursorRing.size(); index++)
        rings->append(ring(frame, index));
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:7,代码来源:CachedNode.cpp


示例17: ring

void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )
{
  QPolygonF poly;

  // just ring outlines, no fill
  p->setPen( mPen );
  p->setBrush( Qt::NoBrush );

  for ( int i = 0; i < polygon.size(); i++ )
  {
    QPolygonF ring( polygon[i].size() + 1 );

    for ( int j = 0; j < polygon[i].size(); j++ )
    {
      ring[ j ] = toCanvasCoordinates( polygon[i][j] ) - pos();
    }

    ring[ polygon[i].size()] = ring[ 0 ];

    p->drawPolygon( ring );

    if ( i == 0 )
      poly = ring;
    else
      poly = poly.subtracted( ring );
  }

  // just fill, no outline
  p->setPen( Qt::NoPen );
  p->setBrush( mBrush );
  p->drawPolygon( poly );
}
开发者ID:coyotte508,项目名称:Quantum-GIS,代码行数:32,代码来源:qgshighlight.cpp


示例18: ring

 inline Polynomial<T, Structure> Polynomial<T, Structure>::pow_eq(exponent_type exponent)
 {
   const ring_type *r = ring();
   AlgebraHelper::pow_eq(r, *this, exponent);
   delete r;
   return *this;
 }
开发者ID:Lykos,项目名称:libsquirrel,代码行数:7,代码来源:polynomial.hpp


示例19: main

int main(int argc, char *argv[]){
    if(argc<4){
        fprintf(stderr,"Error, missing args\n\t1: id (string)\n\t2: udp_port (int)\n\t3: tcp_port (int)");
    }
    id = argv[1];
    udp_port = atoi(argv[2]);
    tcp_port = atoi(argv[3]);
    getOwnIp();
    int exit = 0;
    char* cmd = malloc(100);
    ip_str = IptoStr(inet_ntoa(my_ip));
    //printf("%s\n",ip_str);
    while(!exit){
        fgets(cmd,99,stdin);
        char *token = strsep(&cmd, " ");
        //printf("%s\n",cmd);
        //printf("test\n");
        if(strcmp(token,"RING") == 0){
          ring(cmd);
        }else if(strcmp(token, "JOIN") == 0){
          //printf("test\n");
          connectWELC(cmd);
        }
    }

}
开发者ID:XAMEUS,项目名称:PR6,代码行数:26,代码来源:Main.c


示例20: currentLevel

void SchreyerFrame::show(int len) const
{
  std::cout << "#levels=" << mFrame.mLevels.size() << " currentLevel=" << currentLevel() << std::endl;
  for (int i=0; i<mFrame.mLevels.size(); i++)
    {
      auto& myframe = level(i);
      auto& myorder = schreyerOrder(i);
      if (myframe.size() == 0) continue;
      std::cout << "--- level " << i << " ------" << std::endl;
      for (int j=0; j<myframe.size(); j++)
        {
          std::cout << "    " << j << " " << myframe[j].mDegree 
                    << " (" << myframe[j].mBegin << "," << myframe[j].mEnd << ") " << std::flush;
          std::cout << "(size:" << myframe[j].mSyzygy.len << ") [";
          monoid().showAlpha(myorder.mTotalMonom[j]);
          std::cout << "  " << myorder.mTieBreaker[j] << "] ";
          if (len == 0 or myframe[j].mSyzygy.len == 0)
            monoid().showAlpha(myframe[j].mMonom);
          else
            display_poly(stdout, ring(), myframe[j].mSyzygy);
          std::cout << std::endl;
        }
    }
  showMemoryUsage();
}
开发者ID:pzinn,项目名称:M2,代码行数:25,代码来源:res-schreyer-frame.cpp



注:本文中的ring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ring_vm_runcode函数代码示例发布时间:2022-05-30
下一篇:
C++ rindex函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap