*/
/*
- * GiNaC Copyright (C) 1999-2014 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define DCOUT2(str,var) cout << #str << ": " << var << endl
ostream& operator<<(ostream& o, const vector<int>& v)
{
- vector<int>::const_iterator i = v.begin(), end = v.end();
+ auto i = v.begin(), end = v.end();
while ( i != end ) {
- o << *i++ << " ";
+ o << *i << " ";
+ ++i;
}
return o;
}
static ostream& operator<<(ostream& o, const vector<cl_I>& v)
{
- vector<cl_I>::const_iterator i = v.begin(), end = v.end();
+ auto i = v.begin(), end = v.end();
while ( i != end ) {
o << *i << "[" << i-v.begin() << "]" << " ";
++i;
}
static ostream& operator<<(ostream& o, const vector<cl_MI>& v)
{
- vector<cl_MI>::const_iterator i = v.begin(), end = v.end();
+ auto i = v.begin(), end = v.end();
while ( i != end ) {
o << *i << "[" << i-v.begin() << "]" << " ";
++i;
}
return o;
}
-ostream& operator<<(ostream& o, const vector< vector<cl_MI> >& v)
+ostream& operator<<(ostream& o, const vector<vector<cl_MI>>& v)
{
- vector< vector<cl_MI> >::const_iterator i = v.begin(), end = v.end();
+ auto i = v.begin(), end = v.end();
while ( i != end ) {
o << i-v.begin() << ": " << *i << endl;
++i;
if ( a.empty() ) return;
cl_modint_ring R = a[0].ring();
- umodpoly::iterator i = a.begin(), end = a.end();
- for ( ; i!=end; ++i ) {
+ for (auto & i : a) {
// cln cannot perform this division in the modular field
- cl_I c = R->retract(*i);
- *i = cl_MI(R, the<cl_I>(c / x));
+ cl_I c = R->retract(i);
+ i = cl_MI(R, the<cl_I>(c / x));
}
}
class modular_matrix
{
+#ifdef DEBUGFACTOR
friend ostream& operator<<(ostream& o, const modular_matrix& m);
+#endif
public:
modular_matrix(size_t r_, size_t c_, const cl_MI& init) : r(r_), c(c_)
{
}
factors.push_back(g);
size = 0;
- list<umodpoly>::const_iterator i = factors.begin(), end = factors.end();
- while ( i != end ) {
- if ( degree(*i) ) ++size;
- ++i;
+ for (auto & i : factors) {
+ if (degree(i))
+ ++size;
}
if ( size == k ) {
- list<umodpoly>::const_iterator i = factors.begin(), end = factors.end();
- while ( i != end ) {
- upv.push_back(*i++);
+ for (auto & i : factors) {
+ upv.push_back(i);
}
return;
}
d2 = r2;
}
cl_MI fac = recip(lcoeff(a) * lcoeff(c));
- umodpoly::iterator i = s.begin(), end = s.end();
- for ( ; i!=end; ++i ) {
- *i = *i * fac;
+ for (auto & i : s) {
+ i = i * fac;
}
canonicalize(s);
fac = recip(lcoeff(b) * lcoeff(c));
- i = t.begin(), end = t.end();
- for ( ; i!=end; ++i ) {
- *i = *i * fac;
+ for (auto & i : t) {
+ i = i * fac;
}
canonicalize(t);
}
if ( primes.size() == 0 ) {
primes.push_back(3); primes.push_back(5); primes.push_back(7);
}
- vector<unsigned int>::const_iterator it = primes.begin();
if ( p >= primes.back() ) {
unsigned int candidate = primes.back() + 2;
while ( true ) {
}
return candidate;
}
- vector<unsigned int>::const_iterator end = primes.end();
- for ( ; it!=end; ++it ) {
- if ( *it > p ) {
- return *it;
+ for (auto & it : primes) {
+ if ( it > p ) {
+ return it;
}
}
throw logic_error("next_prime: should not reach this point!");
}
private:
umodpoly lr[2];
- vector< vector<umodpoly> > cache;
+ vector<vector<umodpoly>> cache;
upvec factors;
umodpoly one;
size_t n;
}
else {
upvec newfactors1(part.size_left()), newfactors2(part.size_right());
- upvec::iterator i1 = newfactors1.begin(), i2 = newfactors2.begin();
+ auto i1 = newfactors1.begin(), i2 = newfactors2.begin();
for ( size_t i=0; i<n; ++i ) {
if ( part[i] ) {
*i2++ = tocheck.top().factors[i];
{
if ( a.empty() ) return;
cl_modint_ring oldR = a[0].ring();
- umodpoly::iterator i = a.begin(), end = a.end();
- for ( ; i!=end; ++i ) {
- *i = R->canonhom(oldR->retract(*i));
+ for (auto & i : a) {
+ i = R->canonhom(oldR->retract(i));
}
canonicalize(a);
}
return poly;
}
lst syms;
- exset::const_iterator i=findsymbols.syms.begin(), end=findsymbols.syms.end();
- for ( ; i!=end; ++i ) {
- syms.append(*i);
+ for (auto & i : findsymbols.syms ) {
+ syms.append(i);
}
// make poly square free