コード例 #1
0
ファイル: IISource.cpp プロジェクト: mcdeoliveira/NC
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
};
コード例 #2
0
ファイル: GrbSource.c プロジェクト: lolmid/2015-2016
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();
};
コード例 #3
0
ファイル: SortPattern.c プロジェクト: lolmid/2015-2016
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;
    };
  };
};