Esempio n. 1
0
void GLBase::resetH()
{
  this->hshift=0;
  hIn=1;
  computeCurrent();
  xFactor2=0.1;
  updateGL();
}
Esempio n. 2
0
void ReducerPackDedup<Q>::insert(ConstMonoRef multiple, const Poly& poly) {
  if (poly.isZero())
    return;
  mLeadTermKnown = false;

  NewConstTerm termMultiple = {1, multiple.ptr()};
  auto entry = new (mPool.alloc()) MultipleWithPos(poly, termMultiple);
  entry->computeCurrent(poly.ring());
  mQueue.push(entry);
}
Esempio n. 3
0
void ReducerPackDedup<Q>::insertTail(NewConstTerm multiple, const Poly& poly) {
  if (poly.termCount() <= 1)
    return;
  mLeadTermKnown = false;

  auto entry = new (mPool.alloc()) MultipleWithPos(poly, multiple);
  ++entry->pos;
  entry->computeCurrent(poly.ring());
  mQueue.push(entry);
}
Esempio n. 4
0
void GLBase::hDecrease()
{
  if(hIn>=0.95)
  {
    hIn=1;
    return;
  }
  else if(xFactor2<0.1)
  {
    xFactor2*=2;
    hIn+=xFactor2;
    computeCurrent();
    setHshift(orgShift);
  }else
  {
    hIn+=xFactor2;
    computeCurrent();
    setHshift(orgShift);
  }
}
Esempio n. 5
0
void GLBase::hIncrease()
{
  if(hIn>xFactor2)
  {
    hIn=hIn-xFactor2;
    computeCurrent();
    setHshift(orgShift);
  }
  else
  {
    xFactor2/=2;
    hIncrease();
  }
}
Esempio n. 6
0
GLBase::GLBase(float *buf,int num,float time,bool sample,int sr,QWidget *parent)
    : QGLWidget(QGLFormat(QGL::NoSampleBuffers), parent),
      width(450), height(280), downSample(1),vIn(1),vDe(0),hIn(1),hshift(0),vshift(0),
      bits(0),L(1),currentMin(0),currentMax(time),sampleOrNot(sample),sr(sr),
      time(time),number(num),currentNumItems(num),data(buf),plotData(NULL),orgShift(0),xLabels(NULL),xCor(NULL),
      xShiftW1(30),xFactor2(0.1),replace(false)
{
    this->setWindowTitle("OpenGL widget");
    this->resize(width, height);
    _max=getMax1(buf,num);
    xlabel = new AxisLabel(0, time);
    xScaleW1=number/(width-xShiftW1);
    yScaleW1=(float)(height-height/9)/1.5;
    yShiftW1=(height+height/10)/2;
    yMaxcord = _max*(yScaleW1)+yShiftW1;
    yMincord = 2 * yShiftW1 - yMaxcord;
    ylabel=new AxisLabel(floor(-_max), ceil(_max));
    ylabel->setMaxNumSteps(8);
    computeCurrent();
    computeYCurrent();
}
Esempio n. 7
0
bool ReducerPackDedup<Q>::leadTerm(NewConstTerm& result) {
  if (!mLeadTermKnown) {
    do {
      if (mQueue.empty())
        return false;
      auto entry = mQueue.top();
      entry->currentCoefficient(mRing, mLeadTerm.coef);
      while (true) {
        // store the chained elements
        const auto chainBegin = entry->chain;
        const auto chainEnd = entry; // the list is circular
        entry->chain = entry; // detach any chained elements

        // handle the entry itself
        std::swap(mLeadTerm.mono, entry->current);
        ++entry->pos;
        if (entry->pos == entry->end) {
          mQueue.pop();
          entry->destroy(mRing);
          mPool.free(entry);
        } else {
          entry->computeCurrent(mRing);
          // Inserted spans must be in descending order
          MATHICGB_ASSERT(mQueue.getConfiguration().ring().
            monoid().lessThan(*entry->current, *mLeadTerm.mono));
          mQueue.decreaseTop(entry);
        }

        // handle any chained elements
        auto chain = chainBegin;
        while (chain != chainEnd) {
          MATHICGB_ASSERT(chain != 0);
          MATHICGB_ASSERT(mRing.monoid().equal(*chain->current, *mLeadTerm.mono));

          const auto next = chain->chain;
          chain->chain = chain; // detach from remaining chained elements

          chain->addCurrentCoefficient(mRing, mLeadTerm.coef);
          ++chain->pos;
          if (chain->pos == chain->end) {
            chain->destroy(mRing);
            mPool.free(chain);
          } else {
            chain->computeCurrent(mRing);
            // Inserted spans must be in descending order
            MATHICGB_ASSERT(mQueue.getConfiguration().ring().
              monoid().lessThan(*chain->current, *mLeadTerm.mono));
            mQueue.push(chain);
          }
          chain = next;
        }
      
        if (mQueue.empty())
          break;
      
        entry = mQueue.top();
        if (!mRing.monoid().equal(*entry->current, *mLeadTerm.mono))
          break;
        entry->addCurrentCoefficient(mRing, mLeadTerm.coef);
      }
    } while (mRing.coefficientIsZero(mLeadTerm.coef));
    mLeadTermKnown = true;
  }

  result = mLeadTerm;
  return true;
}