当前位置: 首页>>代码示例>>C++>>正文


C++ Monomial::numberOfFactors方法代码示例

本文整理汇总了C++中Monomial::numberOfFactors方法的典型用法代码示例。如果您正苦于以下问题:C++ Monomial::numberOfFactors方法的具体用法?C++ Monomial::numberOfFactors怎么用?C++ Monomial::numberOfFactors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Monomial的用法示例。


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

示例1: overlapMatch

void MatcherMonomial::overlapMatch(const Monomial & mona,int a,
     const Monomial & monb,int b, list<Match> & result) {
   int leni = mona.numberOfFactors();
   int lenj = monb.numberOfFactors();
   int spread = (leni<lenj) ? leni-1 : lenj-1;
   subMonomial INodei(mona,1,0);
   subMonomial INodej(monb,1,0);
   for(int tempk=1;tempk<=spread;++tempk) {
     INodei.length(0);
     if(tempk>1) {
        INodei.decrementStart();
     } else {
        INodei.start(leni);
     }
     INodei.length(tempk); 
     INodej.length(tempk); 
     // special meaning here
     if(INodei==INodej) {
        Match match;
        constructMatch(mona,a,monb,b,
               INodei,INodej,OVERLAP_MATCH,match);
        result.push_back(match);
     }
   }   
};
开发者ID:mcdeoliveira,项目名称:NC,代码行数:25,代码来源:MatcherMonomial.cpp

示例2: subMatch

void MatcherMonomial::subMatch(const Monomial & mona,int a,
   const Monomial & monb, int b, GBList<Match> & result)  {
  if(mona==monb) {
    Match match;
    match.firstGBData = a;
    match.secondGBData = b;
    match.subsetMatch = true;
    match.overlapMatch = false;
    result.push_back(match);
  } else {
    int leni = mona.numberOfFactors();
    int lenj = monb.numberOfFactors();
    if(leni<lenj) {
      subMonomial INodei(mona,1,0);
      subMonomial INodej(monb,1,0);
  
      const int spread = lenj - leni + 1;
  
      INodei.length(leni);
      INodej.length(leni);
      for(int k=1;k<=spread;++k) {
         if(k>1) INodej.incrementStart();
         if(INodei==INodej) {
            Match match;
            constructMatch(mona,a,monb,b,
               INodei,INodej,SUBSET_MATCH,match);
            result.push_back(match);
         }
      }
    }
  }
};
开发者ID:mcdeoliveira,项目名称:NC,代码行数:32,代码来源:MatcherMonomial.cpp

示例3: grabAtLevel

Monomial Wreath::grabAtLevel(int aLevel,const Monomial & first) const {
  Monomial result;
  MonomialIterator w = first.begin();
  const int sz = first.numberOfFactors();
  for(int i=1;i<=sz;++i,++w) {
    const Variable & v = *w;
    if(level(v)==aLevel) result *= v;
  };
  return result;
};
开发者ID:lolmid,项目名称:2015-2016,代码行数:10,代码来源:Wreath.c

示例4: constructMatch

void MatcherMonomial::constructMatch( const Monomial & mona,int a,
       const Monomial & monb,int b, const subMonomial & aINode,
       const subMonomial & bINode, MATCHING_TYPES type,
       Match & match ) const {
  match.firstGBData = a;
  match.secondGBData = b;

  const int bStartm1 = bINode.start()-1;
  MonomialIterator iter = monb.begin();
  int i=1;
  for(;i<=bStartm1;++i,++iter) {
    match.left1() *= (* iter);
  }
  const int bNumFactor = monb.numberOfFactors();
  int temp2 = bINode.start()+bINode.length();
  if(temp2<=bNumFactor) {
    MonomialIterator iter2 = monb.begin();
    int jj = temp2-1;
    while(jj) { ++iter2;--jj;};
    for(int j=temp2;j<=bNumFactor;++j,++iter2) {
      match.right1() *= (* iter2);
    }
  }
  if(type==SUBSET_MATCH) {
    match.subsetMatch = false;
    match.overlapMatch = true;  
  } else if(type==OVERLAP_MATCH) {
    match.subsetMatch = false;
    match.overlapMatch = true;
    const int aStartm1 = aINode.start()-1;
    MonomialIterator iter3 = mona.begin(); 
    for(i=1;i<=aStartm1;++i,++iter3) {   
       match.left2() *= (* iter3);
    }   
    MonomialIterator iter4 = mona.begin(); 
    const int temp4 = aINode.start()+aINode.length();
    int jj = temp4-1;
    while(jj) { ++iter4;--jj;};
    for(int j=temp4;j<=mona.numberOfFactors();++j,++iter4) {   
       match.right2() *= (* iter4);
    }   
  }
};
开发者ID:mcdeoliveira,项目名称:NC,代码行数:43,代码来源:MatcherMonomial.cpp

示例5: matchExistsNoRecord

bool MatcherMonomial::matchExistsNoRecord(const Monomial & mona,
                                     const Monomial & monb) {
  k = 0; // mutable class variable
  bool result = mona==monb;
  if(!result) {
    int leni = mona.numberOfFactors();
    int lenj = monb.numberOfFactors();
    if(leni<lenj) {
      subMonomial INodei(mona,1,0);
      subMonomial INodej(monb,1,0);

      const int spread = lenj - leni + 1;

      INodei.length(leni);
      INodej.length(leni);
#ifdef NEWCODE
      if(spread>0) {
        Variable v = * mona.begin();
#endif
        for(int tempk = 1; tempk <= spread && !result; ++tempk) {
          if(tempk!=1) {
            INodej.incrementStart();
          }
#ifdef NEWCODE
          tempk = INodej.findVariableForward(spread-tempk+1,v);
          if(tempk==-1) {
            tempk = spread+1;
          } else
#endif
          {
            result = INodei==INodej;
            if(result) k = tempk;
          }
        }
#ifdef NEWCODE
      } else {
        k = 1; // deal with matching against 1
      }
#endif
    }
  }
  return result;
};
开发者ID:mcdeoliveira,项目名称:NC,代码行数:43,代码来源:MatcherMonomial.cpp

示例6: matchExists

bool MatcherMonomial::matchExists(const Monomial & mona,
                             const Monomial & monb) {
  setInternalMatch();
  bool result = matchExistsNoRecord(mona,monb);
  if(result && k > 0) {
    const int beginNum = k-1;
    MonomialIterator iter = monb.begin();
    for(int i = 1; i <= beginNum; ++i,++iter) {
      _theMatch->left1() *= (*iter);
    }
    const int numberFactors = monb.numberOfFactors();
    const int temp2 = k + mona.numberOfFactors();
    if(temp2<=numberFactors) {
      MonomialIterator iter2 = monb.begin();
      int jj = temp2-1;
      while(jj) {++iter2;--jj;};
      for(int j=temp2;j<=numberFactors;++j,++iter2) {
        _theMatch->right1() *= (*iter2);
      }
    }
  }
  return result;
};
开发者ID:mcdeoliveira,项目名称:NC,代码行数:23,代码来源:MatcherMonomial.cpp

示例7: removePowers

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;
    };
  };
};
开发者ID:lolmid,项目名称:2015-2016,代码行数:14,代码来源:SortPattern.c

示例8: put

void NCASink::put(const Monomial& x) {
  int len = x.numberOfFactors();
  if(len==0) {
    d_ofs << '1';
  } else if(len==1) {
    put(*x.begin());
  } else {
    MonomialIterator w = x.begin();
    put(*w);
    --len;++w;
    while(len) {
      d_ofs << " ** ";
      put(*w);
      --len;++w;
    };
  };
};
开发者ID:lolmid,项目名称:2015-2016,代码行数:17,代码来源:NCASink.c

示例9: put

 void MmaSink::put(const Monomial& x) {
#ifdef DEBUG_MMASINK
   GBStream << "sink:monomial " << this << ' ' << x << '\n';
#endif
  int len = x.numberOfFactors();
  if(len==0) {
    MLPutInteger(d_mlink,1);
    ++d_count;
  } else if(len==1) {
    put(*x.begin());
  } else {
    MLPutFunction(d_mlink,"NonCommutativeMultiply",len);
    ++d_count;
    d_count -= len;
    MonomialIterator w = x.begin();
    while(len) {
      put(*w);
      --len;++w;
    };
  };
#ifdef DEBUG_MMASINK
  checkforerror();
#endif
};
开发者ID:lolmid,项目名称:2015-2016,代码行数:24,代码来源:MmaSink.cpp


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