Exemple #1
0
void IISource::get(Monomial& x) {
#if 1
  x.setToOne();
  Variable v;
  int type = getType();
  if(type==GBInputNumbers::s_IOFUNCTION) {
    pair<bool,Alias<ISource> > pr(queryNamedFunction("NonCommutativeMultiply"));
    if(pr.first) {
      while(!pr.second.access().eoi()) {
        pr.second.access().get(v);
        x *= v;
      };
    } else {
      get(v);
      x *= v;
    };
  } else if(type==GBInputNumbers::s_IOINTEGER) {
    int i;
    ((ISource *)this)->get(i);
    if(i!=1) DBG();
  } else if(type==GBInputNumbers::s_IOSYMBOL) {
    get(v);
    x *= v;
  } else {
    TellHead(*this);
    DBG();
  };
#else
  DBG();
#endif
};
Exemple #2
0
void GrbSource::get(Monomial& x) {
  x.setToOne();
  Variable v;
  char s[2];
  s[1]='\0';
  d_so.getCharacter(s[0],"\n *");
  while(('a'<=*s && *s<='z') || ('A'<=*s&& *s<='Z')) {
    v.assign(s);
    x *= v;
    d_so.getCharacter(s[0]);
  };
  d_so.unGetCharacter(s[0]);
  d_eoi = d_so.eof();
};
Exemple #3
0
void removePowers(const Monomial & m,Monomial & result) {
  if(m.numberOfFactors()!=0) {
    Variable v;
    result.setToOne();
    MonomialIterator w = m.begin(), e = m.end();
    while(w!=e) {
      if(v!=*w) {
        v = *w;
        result *= v;
      };
      ++w;
    };
  };
};