本文整理汇总了C++中Monomial::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Monomial::begin方法的具体用法?C++ Monomial::begin怎么用?C++ Monomial::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monomial
的用法示例。
在下文中一共展示了Monomial::begin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
inline
subMonomial::subMonomial(const Monomial & theMonomial,int st,int len) :
_mono(theMonomial), _start(1), _length(0),
start_iterator(theMonomial.begin()) {
start(st);
length(len);
};
示例2: 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;
};
};
};
示例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;
};
示例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);
}
}
};
示例5: 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;
};
示例6: 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;
};
};
};
示例7: 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
};
示例8: 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;
};