Port to C++11 auto keyword
Performed using modernize-use-auto from clang-tidy. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.htmltime-shift
parent
7e003cc591
commit
966a1c2ac0
|
@ -34,20 +34,20 @@ extern "C" {
|
|||
if (nhrs < 12 || nlhs != 2)
|
||||
DYN_MEX_FUNC_ERR_MSG_TXT("dynare_simul_ must have at least 12 input parameters and exactly 2 output arguments.\n");
|
||||
|
||||
int order = (int) mxGetScalar(prhs[0]);
|
||||
auto order = (int) mxGetScalar(prhs[0]);
|
||||
if (nhrs != 12 + order)
|
||||
DYN_MEX_FUNC_ERR_MSG_TXT("dynare_simul_ must have exactly 11+order input parameters.\n");
|
||||
|
||||
int nstat = (int) mxGetScalar(prhs[1]);
|
||||
int npred = (int) mxGetScalar(prhs[2]);
|
||||
int nboth = (int) mxGetScalar(prhs[3]);
|
||||
int nforw = (int) mxGetScalar(prhs[4]);
|
||||
int nexog = (int) mxGetScalar(prhs[5]);
|
||||
auto nstat = (int) mxGetScalar(prhs[1]);
|
||||
auto npred = (int) mxGetScalar(prhs[2]);
|
||||
auto nboth = (int) mxGetScalar(prhs[3]);
|
||||
auto nforw = (int) mxGetScalar(prhs[4]);
|
||||
auto nexog = (int) mxGetScalar(prhs[5]);
|
||||
|
||||
const mxArray *const ystart = prhs[6];
|
||||
const mxArray *const shocks = prhs[7];
|
||||
const mxArray *const vcov = prhs[8];
|
||||
int seed = (int) mxGetScalar(prhs[9]);
|
||||
auto seed = (int) mxGetScalar(prhs[9]);
|
||||
const mxArray *const ysteady = prhs[10];
|
||||
const mwSize *const ystart_dim = mxGetDimensions(ystart);
|
||||
const mwSize *const shocks_dim = mxGetDimensions(shocks);
|
||||
|
@ -102,7 +102,7 @@ extern "C" {
|
|||
ft.zeros();
|
||||
ConstTwoDMatrix gk_mat(ft.nrows(), ft.ncols(), mxGetPr(gk));
|
||||
ft.add(1.0, gk_mat);
|
||||
UFSTensor *ut = new UFSTensor(ft);
|
||||
auto *ut = new UFSTensor(ft);
|
||||
pol.insert(ut);
|
||||
}
|
||||
// form the decision rule
|
||||
|
|
|
@ -33,7 +33,7 @@ double
|
|||
NormalICDF::get(double x)
|
||||
{
|
||||
double xx = (2*normal_icdf_end-1)*std::abs(x-0.5);
|
||||
int i = (int) floor(xx/normal_icdf_step);
|
||||
auto i = (int) floor(xx/normal_icdf_step);
|
||||
double xx1 = normal_icdf_step*i;
|
||||
double yy1 = normal_icdf_data[i];
|
||||
double y;
|
||||
|
|
|
@ -150,8 +150,8 @@ main(int argc, char **argv)
|
|||
// sort and uniq
|
||||
OrderVec ordvec;
|
||||
std::sort(points.begin(), points.end(), ordvec);
|
||||
std::vector<Vector *>::iterator new_end = std::unique(points.begin(), points.end());
|
||||
for (std::vector<Vector *>::iterator it = new_end; it != points.end(); ++it)
|
||||
auto new_end = std::unique(points.begin(), points.end());
|
||||
for (auto it = new_end; it != points.end(); ++it)
|
||||
delete *it;
|
||||
points.erase(new_end, points.end());
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ Approximation::saveRuleDerivs(const FGSContainer &g)
|
|||
rule_ders_ss = new FGSContainer(4);
|
||||
for (auto & run : (*rule_ders))
|
||||
{
|
||||
FGSTensor *ten = new FGSTensor(ypart.nstat+ypart.npred, ypart.nyss(), *(run.second));
|
||||
auto *ten = new FGSTensor(ypart.nstat+ypart.npred, ypart.nyss(), *(run.second));
|
||||
rule_ders_ss->insert(ten);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -489,7 +489,7 @@ IRFResults::writeMat(mat_t *fd, const char *prefix) const
|
|||
void
|
||||
SimulationWorker::operator()()
|
||||
{
|
||||
ExplicitShockRealization *esr = new ExplicitShockRealization(sr, np);
|
||||
auto *esr = new ExplicitShockRealization(sr, np);
|
||||
TwoDMatrix *m = dr.simulate(em, np, st, *esr);
|
||||
{
|
||||
SYNCHRO syn(&res, "simulation");
|
||||
|
@ -503,7 +503,7 @@ SimulationWorker::operator()()
|
|||
void
|
||||
SimulationIRFWorker::operator()()
|
||||
{
|
||||
ExplicitShockRealization *esr
|
||||
auto *esr
|
||||
= new ExplicitShockRealization(res.control.getShocks(idata));
|
||||
esr->addToShock(ishock, 0, imp);
|
||||
const TwoDMatrix &data = res.control.getData(idata);
|
||||
|
|
|
@ -200,7 +200,7 @@ DecisionRuleImpl<t>::fillTensors(const _Tg &g, double sigma)
|
|||
int dfact = 1;
|
||||
for (int d = 0; d <= g.getMaxDim(); d++, dfact *= d)
|
||||
{
|
||||
_Ttensym *g_yud = new _Ttensym(ypart.ny(), ypart.nys()+nu, d);
|
||||
auto *g_yud = new _Ttensym(ypart.ny(), ypart.nys()+nu, d);
|
||||
g_yud->zeros();
|
||||
|
||||
// fill tensor of |g_yud| of dimension |d|
|
||||
|
@ -287,7 +287,7 @@ DecisionRuleImpl<t>::simulate(emethod em, int np, const Vector &ystart,
|
|||
{
|
||||
KORD_RAISE_IF(ysteady.length() != ystart.length(),
|
||||
"Start and steady lengths differ in DecisionRuleImpl::simulate");
|
||||
TwoDMatrix *res = new TwoDMatrix(ypart.ny(), np);
|
||||
auto *res = new TwoDMatrix(ypart.ny(), np);
|
||||
|
||||
// initialize vectors and subvectors for simulation
|
||||
/* Here allocate the stack vector $(\Delta y^*, u)$, define the
|
||||
|
@ -569,7 +569,7 @@ DRFixPoint<t>::fillTensors(const _Tg &g, double sigma)
|
|||
int dfact = 1;
|
||||
for (int d = 0; d <= g.getMaxDim(); d++, dfact *= d)
|
||||
{
|
||||
_Ttensym *g_yd = new _Ttensym(ypart.ny(), ypart.nys(), d);
|
||||
auto *g_yd = new _Ttensym(ypart.ny(), ypart.nys(), d);
|
||||
g_yd->zeros();
|
||||
int kfact = 1;
|
||||
for (int k = 0; d+k <= g.getMaxDim(); k++, kfact *= k)
|
||||
|
|
|
@ -20,7 +20,7 @@ NameList::writeMat(mat_t *fd, const char *vname) const
|
|||
if (maxlen == 0)
|
||||
return;
|
||||
|
||||
char *m = new char[getNum()*maxlen];
|
||||
auto *m = new char[getNum()*maxlen];
|
||||
|
||||
for (int i = 0; i < getNum(); i++)
|
||||
for (int j = 0; j < maxlen; j++)
|
||||
|
|
|
@ -122,7 +122,7 @@ FaaDiBruno::estimRefinment(const TensorDimens &tdims, int nr, int l,
|
|||
{
|
||||
int nthreads = THREAD_GROUP::max_parallel_threads;
|
||||
long int per_size1 = tdims.calcUnfoldMaxOffset();
|
||||
long int per_size2 = (long int) pow((double) tdims.getNVS().getMax(), l);
|
||||
auto per_size2 = (long int) pow((double) tdims.getNVS().getMax(), l);
|
||||
double lambda = 0.0;
|
||||
long int per_size = sizeof(double)*nr
|
||||
*(long int) (lambda*per_size1+(1-lambda)*per_size2);
|
||||
|
|
|
@ -161,7 +161,7 @@ FirstOrder::solve(const TwoDMatrix &fd)
|
|||
TwoDMatrix vsr(n, n);
|
||||
lapack_int lwork = 100*n+16;
|
||||
Vector work(lwork);
|
||||
lapack_int *bwork = new lapack_int[n];
|
||||
auto *bwork = new lapack_int[n];
|
||||
lapack_int info;
|
||||
lapack_int sdim2 = sdim;
|
||||
dgges("N", "V", "S", order_eigs, &n, matE.getData().base(), &n,
|
||||
|
|
|
@ -101,7 +101,7 @@ ResidFunction::setYU(const Vector &ys, const Vector &xx)
|
|||
}
|
||||
else
|
||||
{
|
||||
FFSTensor *ten = new FFSTensor(hss->nrows(), hss->nvars(), 0);
|
||||
auto *ten = new FFSTensor(hss->nrows(), hss->nvars(), 0);
|
||||
ten->getData() = ysteady_ss;
|
||||
hss->insert(ten);
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ KOrder::switchToFolded()
|
|||
{
|
||||
if ((*si)[2] == 0 && g<unfold>().check(*si))
|
||||
{
|
||||
FGSTensor *ft = new FGSTensor(*(g<unfold>().get(*si)));
|
||||
auto *ft = new FGSTensor(*(g<unfold>().get(*si)));
|
||||
insertDerivative<fold>(ft);
|
||||
if (dim > 1)
|
||||
{
|
||||
|
@ -357,7 +357,7 @@ KOrder::switchToFolded()
|
|||
}
|
||||
if (G<unfold>().check(*si))
|
||||
{
|
||||
FGSTensor *ft = new FGSTensor(*(G<unfold>().get(*si)));
|
||||
auto *ft = new FGSTensor(*(G<unfold>().get(*si)));
|
||||
G<fold>().insert(ft);
|
||||
if (dim > 1)
|
||||
{
|
||||
|
|
|
@ -450,7 +450,7 @@ KOrder::faaDiBrunoG(const Symmetry &sym) const
|
|||
JournalRecordPair pa(journal);
|
||||
pa << "Faa Di Bruno G container for " << sym << endrec;
|
||||
TensorDimens tdims(sym, nvs);
|
||||
_Ttensor *res = new _Ttensor(ypart.nyss(), tdims);
|
||||
auto *res = new _Ttensor(ypart.nyss(), tdims);
|
||||
FaaDiBruno bruno(journal);
|
||||
bruno.calculate(Gstack<t>(), gss<t>(), *res);
|
||||
return res;
|
||||
|
@ -926,7 +926,7 @@ template <int t>
|
|||
Vector *
|
||||
KOrder::calcStochShift(int order, double sigma) const
|
||||
{
|
||||
Vector *res = new Vector(ny);
|
||||
auto *res = new Vector(ny);
|
||||
res->zeros();
|
||||
int jfac = 1;
|
||||
for (int j = 1; j <= order; j++, jfac *= j)
|
||||
|
|
|
@ -182,7 +182,7 @@ StochForwardDerivs<t>::StochForwardDerivs(const PartitionY &ypart, int nu,
|
|||
_Tpol g_int_sym(r, ypart.nys()+1);
|
||||
for (int d = 1; d <= maxd; d++)
|
||||
{
|
||||
_Ttensym *ten = new _Ttensym(r, ypart.nys()+1, d);
|
||||
auto *ten = new _Ttensym(r, ypart.nys()+1, d);
|
||||
ten->zeros();
|
||||
for (int i = 0; i <= d; i++)
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ KOrderStoch::faaDiBrunoG(const Symmetry &sym) const
|
|||
JournalRecordPair pa(journal);
|
||||
pa << "Faa Di Bruno GX container for " << sym << endrec;
|
||||
TensorDimens tdims(sym, nvs);
|
||||
_Ttensor *res = new _Ttensor(ypart.nyss(), tdims);
|
||||
auto *res = new _Ttensor(ypart.nyss(), tdims);
|
||||
FaaDiBruno bruno(journal);
|
||||
bruno.calculate(Gstack<t>(), h<t>(), *res);
|
||||
return res;
|
||||
|
|
|
@ -54,7 +54,7 @@ FSSparseTensor *
|
|||
SparseGenerator::makeTensor(int dim, int nv, int r,
|
||||
double fill, double m)
|
||||
{
|
||||
FSSparseTensor *res = new FSSparseTensor(dim, nv, r);
|
||||
auto *res = new FSSparseTensor(dim, nv, r);
|
||||
FFSTensor dummy(0, nv, dim);
|
||||
for (Tensor::index fi = dummy.begin(); fi != dummy.end(); ++fi)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ extern location_type asgn_lloc;
|
|||
void
|
||||
AtomAssignings::parse(int length, const char *stream)
|
||||
{
|
||||
char *buffer = new char[length+2];
|
||||
auto *buffer = new char[length+2];
|
||||
strncpy(buffer, stream, length);
|
||||
buffer[length] = '\0';
|
||||
buffer[length+1] = '\0';
|
||||
|
@ -104,7 +104,7 @@ AtomAssignings::add_assignment(int asgn_off, const char *str, int name_len,
|
|||
|
||||
// find the name in the atoms, make copy of name to be able to put
|
||||
// '\0' at the end
|
||||
char *buf = new char[name_len+1];
|
||||
auto *buf = new char[name_len+1];
|
||||
strncpy(buf, str, name_len);
|
||||
buf[name_len] = '\0';
|
||||
// if left hand side is a registered atom, insert it to tree
|
||||
|
@ -203,7 +203,7 @@ AtomAsgnEvaluator::setValues(EvalTree &et) const
|
|||
int t = aa.atoms.index(ss);
|
||||
if (t >= 0)
|
||||
{
|
||||
Tusrvalmap::const_iterator it = user_values.find(t);
|
||||
auto it = user_values.find(t);
|
||||
if (it == user_values.end())
|
||||
et.set_nulary(t, nan);
|
||||
else
|
||||
|
@ -218,7 +218,7 @@ AtomAsgnEvaluator::set_user_value(const char *name, double val)
|
|||
int t = aa.atoms.index(name);
|
||||
if (t >= 0)
|
||||
{
|
||||
Tusrvalmap::iterator it = user_values.find(t);
|
||||
auto it = user_values.find(t);
|
||||
if (it == user_values.end())
|
||||
user_values.insert(Tusrvalmap::value_type(t, val));
|
||||
else
|
||||
|
@ -240,7 +240,7 @@ AtomAsgnEvaluator::load(int i, double res)
|
|||
double
|
||||
AtomAsgnEvaluator::get_value(const char *name) const
|
||||
{
|
||||
AtomAssignings::Tvarintmap::const_iterator it = aa.lname2expr.find(name);
|
||||
auto it = aa.lname2expr.find(name);
|
||||
if (it == aa.lname2expr.end())
|
||||
return std::numeric_limits<double>::quiet_NaN();
|
||||
else
|
||||
|
|
|
@ -22,7 +22,7 @@ AtomSubstitutions::AtomSubstitutions(const AtomSubstitutions &as, const FineAtom
|
|||
for (const auto & it : as.old2new)
|
||||
{
|
||||
Tshiftnameset sset;
|
||||
for (Tshiftnameset::const_iterator itt = it.second.begin();
|
||||
for (auto itt = it.second.begin();
|
||||
itt != it.second.end(); ++itt)
|
||||
sset.insert(Tshiftname(ns.query((*itt).first), (*itt).second));
|
||||
old2new.insert(Toldnamemap::value_type(ns.query(it.first), sset));
|
||||
|
@ -42,7 +42,7 @@ AtomSubstitutions::add_substitution(const char *newname, const char *oldname, in
|
|||
// insert to new2old map
|
||||
new2old.insert(Tshiftmap::value_type(newname, Tshiftname(oldname, tshift)));
|
||||
// insert to old2new map
|
||||
Toldnamemap::iterator it = old2new.find(oldname);
|
||||
auto it = old2new.find(oldname);
|
||||
if (it != old2new.end())
|
||||
(*it).second.insert(Tshiftname(newname, -tshift));
|
||||
else
|
||||
|
@ -80,7 +80,7 @@ AtomSubstitutions::substitutions_finished(VarOrdering::ord_type ot)
|
|||
const char *
|
||||
AtomSubstitutions::get_new4old(const char *oldname, int tshift) const
|
||||
{
|
||||
Toldnamemap::const_iterator it = old2new.find(oldname);
|
||||
auto it = old2new.find(oldname);
|
||||
if (it != old2new.end())
|
||||
{
|
||||
const Tshiftnameset &sset = (*it).second;
|
||||
|
@ -96,7 +96,7 @@ AtomSubstitutions::print() const
|
|||
{
|
||||
printf("Atom Substitutions:\nOld ==> New:\n");
|
||||
for (const auto & it : old2new)
|
||||
for (Tshiftnameset::const_iterator itt = it.second.begin();
|
||||
for (auto itt = it.second.begin();
|
||||
itt != it.second.end(); ++itt)
|
||||
printf(" %s ==> [%s, %d]\n", it.first, (*itt).first, (*itt).second);
|
||||
|
||||
|
@ -164,7 +164,7 @@ SAtoms::findNameWithLeadInInterval(const vector<const char *> &names,
|
|||
{
|
||||
for (auto name : names)
|
||||
{
|
||||
DynamicAtoms::Tvarmap::const_iterator it = vars.find(name);
|
||||
auto it = vars.find(name);
|
||||
if (it != vars.end())
|
||||
{
|
||||
const DynamicAtoms::Tlagmap &lmap = (*it).second;
|
||||
|
|
|
@ -28,7 +28,7 @@ void
|
|||
CSVParser::csv_parse(int length, const char *str)
|
||||
{
|
||||
// allocate temporary buffer and parse
|
||||
char *buffer = new char[length+2];
|
||||
auto *buffer = new char[length+2];
|
||||
strncpy(buffer, str, length);
|
||||
buffer[length] = '\0';
|
||||
buffer[length+1] = '\0';
|
||||
|
|
|
@ -14,7 +14,7 @@ NameStorage::NameStorage(const NameStorage &stor)
|
|||
{
|
||||
for (auto i : stor.name_store)
|
||||
{
|
||||
char *str = new char[strlen(i)+1];
|
||||
auto *str = new char[strlen(i)+1];
|
||||
strcpy(str, i);
|
||||
name_store.push_back(str);
|
||||
name_set.insert(str);
|
||||
|
@ -33,7 +33,7 @@ NameStorage::~NameStorage()
|
|||
const char *
|
||||
NameStorage::query(const char *name) const
|
||||
{
|
||||
set<const char *, ltstr>::const_iterator it = name_set.find(name);
|
||||
auto it = name_set.find(name);
|
||||
if (it == name_set.end())
|
||||
return NULL;
|
||||
else
|
||||
|
@ -43,10 +43,10 @@ NameStorage::query(const char *name) const
|
|||
const char *
|
||||
NameStorage::insert(const char *name)
|
||||
{
|
||||
set<const char *, ltstr>::const_iterator it = name_set.find(name);
|
||||
auto it = name_set.find(name);
|
||||
if (it == name_set.end())
|
||||
{
|
||||
char *str = new char[strlen(name)+1];
|
||||
auto *str = new char[strlen(name)+1];
|
||||
strcpy(str, name);
|
||||
name_store.push_back(str);
|
||||
name_set.insert(str);
|
||||
|
@ -97,14 +97,14 @@ Constants::is_constant(int t) const
|
|||
{
|
||||
if (t < OperationTree::num_constants)
|
||||
return true;
|
||||
Tconstantmap::const_iterator it = cmap.find(t);
|
||||
auto it = cmap.find(t);
|
||||
return (it != cmap.end());
|
||||
}
|
||||
|
||||
double
|
||||
Constants::get_constant_value(int t) const
|
||||
{
|
||||
Tconstantmap::const_iterator it = cmap.find(t);
|
||||
auto it = cmap.find(t);
|
||||
if (it != cmap.end())
|
||||
return (*it).second;
|
||||
else
|
||||
|
@ -120,7 +120,7 @@ Constants::check(const char *str) const
|
|||
{
|
||||
double d;
|
||||
sscanf(str, "%lf", &d);
|
||||
Tconstantinvmap::const_iterator it = cinvmap.find(d);
|
||||
auto it = cinvmap.find(d);
|
||||
if (it != cinvmap.end())
|
||||
return (*it).second;
|
||||
else
|
||||
|
@ -170,12 +170,12 @@ DynamicAtoms::check_variable(const char *name) const
|
|||
string str;
|
||||
int ll;
|
||||
parse_variable(name, str, ll);
|
||||
Tvarmap::const_iterator it = vars.find(str.c_str());
|
||||
auto it = vars.find(str.c_str());
|
||||
|
||||
if (it != vars.end())
|
||||
{
|
||||
const Tlagmap &lmap = (*it).second;
|
||||
Tlagmap::const_iterator itt = lmap.find(ll);
|
||||
auto itt = lmap.find(ll);
|
||||
if (itt != lmap.end())
|
||||
return (*itt).second;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ DynamicAtoms::assign_variable(const char *varname, int ll, int t)
|
|||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Attempt to assign already allocated tree index");
|
||||
|
||||
Tvarmap::iterator it = vars.find(varname);
|
||||
auto it = vars.find(varname);
|
||||
if (it != vars.end())
|
||||
{
|
||||
Tlagmap &lmap = (*it).second;
|
||||
|
@ -247,11 +247,11 @@ DynamicAtoms::assign_variable(const char *varname, int ll, int t)
|
|||
void
|
||||
DynamicAtoms::unassign_variable(const char *varname, int ll, int t)
|
||||
{
|
||||
Tvarmap::iterator it = vars.find(varname);
|
||||
auto it = vars.find(varname);
|
||||
if (it != vars.end())
|
||||
{
|
||||
Tlagmap &lmap = (*it).second;
|
||||
Tlagmap::iterator itt = lmap.find(ll);
|
||||
auto itt = lmap.find(ll);
|
||||
if (itt != lmap.end())
|
||||
{
|
||||
if ((*itt).second == t)
|
||||
|
@ -262,7 +262,7 @@ DynamicAtoms::unassign_variable(const char *varname, int ll, int t)
|
|||
if (lmap.size() == 0)
|
||||
vars.erase(it);
|
||||
// erase it from the indices
|
||||
Tindexmap::iterator ittt = indices.find(t);
|
||||
auto ittt = indices.find(t);
|
||||
if (ittt != indices.end())
|
||||
indices.erase(ittt);
|
||||
|
||||
|
@ -318,7 +318,7 @@ DynamicAtoms::variables() const
|
|||
void
|
||||
DynamicAtoms::varspan(int t, int &mlead, int &mlag) const
|
||||
{
|
||||
Tindexmap::const_iterator it = indices.find(t);
|
||||
auto it = indices.find(t);
|
||||
if (indices.end() == it)
|
||||
{
|
||||
mlead = INT_MIN;
|
||||
|
@ -331,7 +331,7 @@ DynamicAtoms::varspan(int t, int &mlead, int &mlag) const
|
|||
void
|
||||
DynamicAtoms::varspan(const char *name, int &mlead, int &mlag) const
|
||||
{
|
||||
Tvarmap::const_iterator it = vars.find(name);
|
||||
auto it = vars.find(name);
|
||||
if (vars.end() == it)
|
||||
{
|
||||
mlead = INT_MIN;
|
||||
|
@ -339,8 +339,8 @@ DynamicAtoms::varspan(const char *name, int &mlead, int &mlag) const
|
|||
return;
|
||||
}
|
||||
const Tlagmap &lmap = (*it).second;
|
||||
Tlagmap::const_iterator beg = lmap.begin();
|
||||
Tlagmap::const_reverse_iterator end = lmap.rbegin();
|
||||
auto beg = lmap.begin();
|
||||
auto end = lmap.rbegin();
|
||||
mlag = (*beg).first;
|
||||
mlead = (*end).first;
|
||||
}
|
||||
|
@ -370,11 +370,11 @@ DynamicAtoms::is_named_atom(int t) const
|
|||
int
|
||||
DynamicAtoms::index(const char *name, int ll) const
|
||||
{
|
||||
Tvarmap::const_iterator it = vars.find(name);
|
||||
auto it = vars.find(name);
|
||||
if (vars.end() != it)
|
||||
{
|
||||
const Tlagmap &lmap = (*it).second;
|
||||
Tlagmap::const_iterator itt = lmap.find(ll);
|
||||
auto itt = lmap.find(ll);
|
||||
if (lmap.end() != itt)
|
||||
return (*itt).second;
|
||||
}
|
||||
|
@ -384,14 +384,14 @@ DynamicAtoms::index(const char *name, int ll) const
|
|||
bool
|
||||
DynamicAtoms::is_referenced(const char *name) const
|
||||
{
|
||||
Tvarmap::const_iterator it = vars.find(name);
|
||||
auto it = vars.find(name);
|
||||
return it != vars.end();
|
||||
}
|
||||
|
||||
const DynamicAtoms::Tlagmap &
|
||||
DynamicAtoms::lagmap(const char *name) const
|
||||
{
|
||||
Tvarmap::const_iterator it = vars.find(name);
|
||||
auto it = vars.find(name);
|
||||
if (vars.end() == it)
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
std::string("Couldn't find the name ")
|
||||
|
@ -402,7 +402,7 @@ DynamicAtoms::lagmap(const char *name) const
|
|||
const char *
|
||||
DynamicAtoms::name(int t) const
|
||||
{
|
||||
Tindexmap::const_iterator it = indices.find(t);
|
||||
auto it = indices.find(t);
|
||||
if (indices.end() == it)
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Couldn't find tree index in DynamicAtoms::name");
|
||||
|
@ -414,7 +414,7 @@ DynamicAtoms::lead(int t) const
|
|||
{
|
||||
const char *nam = name(t);
|
||||
const Tlagmap &lmap = lagmap(nam);
|
||||
Tlagmap::const_iterator it = lmap.begin();
|
||||
auto it = lmap.begin();
|
||||
while (it != lmap.end() && (*it).second != t)
|
||||
++it;
|
||||
if (lmap.end() == it)
|
||||
|
@ -462,14 +462,14 @@ VarOrdering::VarOrdering(const VarOrdering &vo, const vector<const char *> &vnam
|
|||
bool
|
||||
VarOrdering::check(int t) const
|
||||
{
|
||||
map<int, int>::const_iterator it = positions.find(t);
|
||||
auto it = positions.find(t);
|
||||
return it != positions.end();
|
||||
}
|
||||
|
||||
int
|
||||
VarOrdering::get_pos_of(int t) const
|
||||
{
|
||||
map<int, int>::const_iterator it = positions.find(t);
|
||||
auto it = positions.find(t);
|
||||
if (it != positions.end())
|
||||
{
|
||||
return (*it).second;
|
||||
|
|
|
@ -29,7 +29,7 @@ AllvarOuterOrdering::AllvarOuterOrdering(const vector<const char *> &allvar_oute
|
|||
// fill in endo2all and exo2all
|
||||
for (unsigned int i = 0; i < allvar.size(); i++)
|
||||
{
|
||||
Tvarintmap::const_iterator it = atoms.endo_outer_map.find(allvar[i]);
|
||||
auto it = atoms.endo_outer_map.find(allvar[i]);
|
||||
if (it != atoms.endo_outer_map.end())
|
||||
endo2all[(*it).second] = i;
|
||||
else
|
||||
|
@ -387,7 +387,7 @@ FineAtoms::get_exo_atoms_map() const
|
|||
int
|
||||
FineAtoms::name2outer_param(const char *name) const
|
||||
{
|
||||
Tvarintmap::const_iterator it = param_outer_map.find(name);
|
||||
auto it = param_outer_map.find(name);
|
||||
if (it == param_outer_map.end())
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Name is not a parameter in FineAtoms::name2outer_param");
|
||||
|
@ -397,7 +397,7 @@ FineAtoms::name2outer_param(const char *name) const
|
|||
int
|
||||
FineAtoms::name2outer_endo(const char *name) const
|
||||
{
|
||||
Tvarintmap::const_iterator it = endo_outer_map.find(name);
|
||||
auto it = endo_outer_map.find(name);
|
||||
if (it == endo_outer_map.end())
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Name is not an endogenous variable in FineAtoms::name2outer_endo");
|
||||
|
@ -407,7 +407,7 @@ FineAtoms::name2outer_endo(const char *name) const
|
|||
int
|
||||
FineAtoms::name2outer_exo(const char *name) const
|
||||
{
|
||||
Tvarintmap::const_iterator it = exo_outer_map.find(name);
|
||||
auto it = exo_outer_map.find(name);
|
||||
if (it == exo_outer_map.end())
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Name is not an exogenous variable in FineAtoms::name2outer_exo");
|
||||
|
@ -421,7 +421,7 @@ FineAtoms::name2outer_allvar(const char *name) const
|
|||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"FineAtoms::name2outer_allvar called beore parsing_finished");
|
||||
|
||||
Tvarintmap::const_iterator it = endo_outer_map.find(name);
|
||||
auto it = endo_outer_map.find(name);
|
||||
if (it != endo_outer_map.end())
|
||||
return allvar_order->get_endo2all()[(*it).second];
|
||||
else
|
||||
|
|
|
@ -133,7 +133,7 @@ extern location_type fmla_lloc;
|
|||
void
|
||||
FormulaParser::parse(int length, const char *stream)
|
||||
{
|
||||
char *buffer = new char[length+2];
|
||||
auto *buffer = new char[length+2];
|
||||
strncpy(buffer, stream, length);
|
||||
buffer[length] = '\0';
|
||||
buffer[length+1] = '\0';
|
||||
|
@ -273,7 +273,7 @@ FormulaDerivatives::derivative(const FoldMultiIndex &mi) const
|
|||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Wrong multi-index variables in FormulaDerivatives::derivative");
|
||||
|
||||
Tfmiintmap::const_iterator it = ind2der.find(mi);
|
||||
auto it = ind2der.find(mi);
|
||||
if (it == ind2der.end())
|
||||
return OperationTree::zero;
|
||||
else
|
||||
|
@ -428,7 +428,7 @@ int
|
|||
FoldMultiIndex::offset() const
|
||||
{
|
||||
// make copy for the recursions
|
||||
int *tmp = new int[ord];
|
||||
auto *tmp = new int[ord];
|
||||
for (int i = 0; i < ord; i++)
|
||||
tmp[i] = data[i];
|
||||
// call the recursive algorithm
|
||||
|
@ -499,11 +499,11 @@ FormulaDerEvaluator::eval(const AtomValues &av, FormulaDerEvalLoader &loader, in
|
|||
etree.reset_all();
|
||||
av.setValues(etree);
|
||||
|
||||
int *vars = new int[order];
|
||||
auto *vars = new int[order];
|
||||
|
||||
for (unsigned int i = 0; i < ders.size(); i++)
|
||||
{
|
||||
for (FormulaDerivatives::Tfmiintmap::const_iterator it = ders[i]->ind2der.begin();
|
||||
for (auto it = ders[i]->ind2der.begin();
|
||||
it != ders[i]->ind2der.end(); ++it)
|
||||
{
|
||||
const FoldMultiIndex &mi = (*it).first;
|
||||
|
@ -532,7 +532,7 @@ FormulaDerEvaluator::eval(const vector<int> &mp, const AtomValues &av,
|
|||
|
||||
int nvar_glob = der_atoms.size();
|
||||
int nvar = mp.size();
|
||||
int *vars = new int[order];
|
||||
auto *vars = new int[order];
|
||||
|
||||
for (unsigned int i = 0; i < ders.size(); i++)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ MatrixParser::parse(int length, const char *stream)
|
|||
row_lengths.clear();
|
||||
nc = 0;
|
||||
// allocate temporary buffer and parse
|
||||
char *buffer = new char[length+2];
|
||||
auto *buffer = new char[length+2];
|
||||
strncpy(buffer, stream, length);
|
||||
buffer[length] = '\0';
|
||||
buffer[length+1] = '\0';
|
||||
|
|
|
@ -19,7 +19,7 @@ void namelist_parse();
|
|||
void
|
||||
NameListParser::namelist_parse(int length, const char *stream)
|
||||
{
|
||||
char *buffer = new char[length+2];
|
||||
auto *buffer = new char[length+2];
|
||||
strncpy(buffer, stream, length);
|
||||
buffer[length] = '\0';
|
||||
buffer[length+1] = '\0';
|
||||
|
|
|
@ -72,7 +72,7 @@ StaticAtoms::check(const char *name) const
|
|||
int
|
||||
StaticAtoms::index(const char *name) const
|
||||
{
|
||||
Tvarmap::const_iterator it = vars.find(name);
|
||||
auto it = vars.find(name);
|
||||
if (it == vars.end())
|
||||
return -1;
|
||||
else
|
||||
|
@ -82,7 +82,7 @@ StaticAtoms::index(const char *name) const
|
|||
const char *
|
||||
StaticAtoms::inv_index(int t) const
|
||||
{
|
||||
Tinvmap::const_iterator it = indices.find(t);
|
||||
auto it = indices.find(t);
|
||||
if (it == indices.end())
|
||||
return NULL;
|
||||
else
|
||||
|
|
|
@ -135,7 +135,7 @@ StaticFineAtoms::parsing_finished()
|
|||
int
|
||||
StaticFineAtoms::name2outer_param(const char *name) const
|
||||
{
|
||||
Tvarintmap::const_iterator it = param_outer_map.find(name);
|
||||
auto it = param_outer_map.find(name);
|
||||
if (it == param_outer_map.end())
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Name is not a parameter in StaticFineAtoms::name2outer_param");
|
||||
|
@ -145,7 +145,7 @@ StaticFineAtoms::name2outer_param(const char *name) const
|
|||
int
|
||||
StaticFineAtoms::name2outer_endo(const char *name) const
|
||||
{
|
||||
Tvarintmap::const_iterator it = endo_outer_map.find(name);
|
||||
auto it = endo_outer_map.find(name);
|
||||
if (it == endo_outer_map.end())
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Name is not an endogenous variable in StaticFineAtoms::name2outer_endo");
|
||||
|
@ -155,7 +155,7 @@ StaticFineAtoms::name2outer_endo(const char *name) const
|
|||
int
|
||||
StaticFineAtoms::name2outer_exo(const char *name) const
|
||||
{
|
||||
Tvarintmap::const_iterator it = exo_outer_map.find(name);
|
||||
auto it = exo_outer_map.find(name);
|
||||
if (it == exo_outer_map.end())
|
||||
throw ogu::Exception(__FILE__, __LINE__,
|
||||
"Name is not an exogenous variable in StaticFineAtoms::name2outer_exo");
|
||||
|
|
|
@ -54,7 +54,7 @@ OperationTree::add_unary(code_t code, int op)
|
|||
return one;
|
||||
|
||||
Operation unary(code, op);
|
||||
_Topmap::const_iterator i = ((const _Topmap &) opmap).find(unary);
|
||||
auto i = ((const _Topmap &) opmap).find(unary);
|
||||
if (i == opmap.end())
|
||||
{
|
||||
int newop = terms.size();
|
||||
|
@ -144,7 +144,7 @@ OperationTree::add_binary(code_t code, int op1, int op2)
|
|||
|
||||
// construct operation and check/add it
|
||||
Operation binary(code, op1, op2);
|
||||
_Topmap::const_iterator i = ((const _Topmap &) opmap).find(binary);
|
||||
auto i = ((const _Topmap &) opmap).find(binary);
|
||||
if (i == opmap.end())
|
||||
{
|
||||
int newop = terms.size();
|
||||
|
@ -334,7 +334,7 @@ OperationTree::add_substitution(int t, const map<int, int> &subst,
|
|||
const OperationTree &otree)
|
||||
{
|
||||
// return substitution of t if it is in the map
|
||||
map<int, int>::const_iterator it = subst.find(t);
|
||||
auto it = subst.find(t);
|
||||
if (subst.end() != it)
|
||||
return (*it).second;
|
||||
|
||||
|
@ -374,7 +374,7 @@ void
|
|||
OperationTree::nularify(int t)
|
||||
{
|
||||
// remove the original operation from opmap
|
||||
_Topmap::iterator it = opmap.find(terms[t]);
|
||||
auto it = opmap.find(terms[t]);
|
||||
if (it != opmap.end())
|
||||
opmap.erase(it);
|
||||
// turn the operation to nulary
|
||||
|
|
|
@ -333,7 +333,7 @@ DynareDerEvalLoader::DynareDerEvalLoader(const ogp::FineAtoms &a,
|
|||
md.clear();
|
||||
for (int iord = 1; iord <= order; iord++)
|
||||
{
|
||||
FSSparseTensor *t = new FSSparseTensor(iord, atoms.ny()+atoms.nys()+atoms.nyss()+atoms.nexo(), atoms.ny());
|
||||
auto *t = new FSSparseTensor(iord, atoms.ny()+atoms.nys()+atoms.nyss()+atoms.nexo(), atoms.ny());
|
||||
md.insert(t);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ DynareStaticAtoms::check_variable(const char *name) const
|
|||
{
|
||||
if (0 == varnames.query(name))
|
||||
throw ogp::ParserException(std::string("Unknown name <")+name+">", 0);
|
||||
Tvarmap::const_iterator it = vars.find(name);
|
||||
auto it = vars.find(name);
|
||||
if (it == vars.end())
|
||||
return -1;
|
||||
else
|
||||
|
@ -88,7 +88,7 @@ DynareDynamicAtoms::register_uniq_param(const char *name)
|
|||
bool
|
||||
DynareDynamicAtoms::is_type(const char *name, atype tp) const
|
||||
{
|
||||
Tatypemap::const_iterator it = atom_type.find(name);
|
||||
auto it = atom_type.find(name);
|
||||
if (it != atom_type.end() && (*it).second == tp)
|
||||
return true;
|
||||
else
|
||||
|
|
|
@ -593,7 +593,7 @@ extern ogp::location_type dynglob_lloc;
|
|||
void
|
||||
DynareParser::parse_glob(int length, const char *stream)
|
||||
{
|
||||
char *buffer = new char[length+2];
|
||||
auto *buffer = new char[length+2];
|
||||
strncpy(buffer, stream, length);
|
||||
buffer[length] = '\0';
|
||||
buffer[length+1] = '\0';
|
||||
|
@ -607,7 +607,7 @@ DynareParser::parse_glob(int length, const char *stream)
|
|||
int
|
||||
DynareParser::parse_order(int len, const char *str)
|
||||
{
|
||||
char *buf = new char[len+1];
|
||||
auto *buf = new char[len+1];
|
||||
strncpy(buf, str, len);
|
||||
buf[len] = '\0';
|
||||
int res;
|
||||
|
@ -619,7 +619,7 @@ DynareParser::parse_order(int len, const char *str)
|
|||
int
|
||||
DynareParser::parse_pldiscount(int len, const char *str)
|
||||
{
|
||||
char *buf = new char[len+1];
|
||||
auto *buf = new char[len+1];
|
||||
strncpy(buf, str, len);
|
||||
buf[len] = '\0';
|
||||
if (!atoms.is_type(buf, DynareDynamicAtoms::param))
|
||||
|
|
|
@ -453,7 +453,7 @@ ConstGeneralMatrix::multInvLeft(const char *trans, int mrows, int mcols, int mld
|
|||
if (rows > 0)
|
||||
{
|
||||
GeneralMatrix inv(*this);
|
||||
lapack_int *ipiv = new lapack_int[rows];
|
||||
auto *ipiv = new lapack_int[rows];
|
||||
lapack_int info;
|
||||
lapack_int rows2 = rows, mcols2 = mcols, mld2 = mld;
|
||||
dgetrf(&rows2, &rows2, inv.getData().base(), &rows2, ipiv, &info);
|
||||
|
@ -564,7 +564,7 @@ SVDDecomp::construct(const GeneralMatrix &A)
|
|||
lapack_int lwork = -1;
|
||||
lapack_int info;
|
||||
|
||||
lapack_int *iwork = new lapack_int[8*minmn];
|
||||
auto *iwork = new lapack_int[8*minmn];
|
||||
// query for optimal lwork
|
||||
dgesdd("A", &m, &n, a, &lda, s, u, &ldu, vt, &ldvt, &tmpwork,
|
||||
&lwork, iwork, &info);
|
||||
|
|
|
@ -478,7 +478,7 @@ QuasiTriangular::QuasiTriangular(const SchurDecompZero &decomp)
|
|||
}
|
||||
}
|
||||
// construct diagonal
|
||||
Diagonal *const d = new Diagonal(getData().base(), decomp.getDim());
|
||||
auto *const d = new Diagonal(getData().base(), decomp.getDim());
|
||||
diagonal = *d;
|
||||
delete d;
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ SchurDecomp::SchurDecomp(const SqSylvMatrix &m)
|
|||
q = new SqSylvMatrix(rows);
|
||||
SqSylvMatrix auxt(m);
|
||||
lapack_int sdim;
|
||||
double *const wr = new double[rows];
|
||||
double *const wi = new double[rows];
|
||||
auto *const wr = new double[rows];
|
||||
auto *const wi = new double[rows];
|
||||
lapack_int lwork = 6*rows;
|
||||
double *const work = new double[lwork];
|
||||
auto *const work = new double[lwork];
|
||||
lapack_int info;
|
||||
dgees("V", "N", 0, &rows, auxt.base(), &rows, &sdim,
|
||||
wr, wi, q->base(), &rows,
|
||||
|
|
|
@ -55,7 +55,7 @@ SchurDecompEig::tryToSwap(diag_iter &it, diag_iter &itadd)
|
|||
lapack_int n = getDim();
|
||||
lapack_int ifst = (*it).getIndex() + 1;
|
||||
lapack_int ilst = (*itadd).getIndex() + 1;
|
||||
double *work = new double[n];
|
||||
auto *work = new double[n];
|
||||
lapack_int info;
|
||||
dtrexc("V", &n, getT().base(), &n, getQ().base(), &n, &ifst, &ilst, work,
|
||||
&info);
|
||||
|
|
|
@ -242,7 +242,7 @@ SqSylvMatrix::multInvLeft2(GeneralMatrix &a, GeneralMatrix &b,
|
|||
}
|
||||
// PLU factorization
|
||||
Vector inv(data);
|
||||
lapack_int *const ipiv = new lapack_int[rows];
|
||||
auto *const ipiv = new lapack_int[rows];
|
||||
lapack_int info;
|
||||
lapack_int rows2 = rows;
|
||||
dgetrf(&rows2, &rows2, inv.base(), &rows2, ipiv, &info);
|
||||
|
@ -259,8 +259,8 @@ SqSylvMatrix::multInvLeft2(GeneralMatrix &a, GeneralMatrix &b,
|
|||
delete [] ipiv;
|
||||
|
||||
// condition numbers
|
||||
double *const work = new double[4*rows];
|
||||
lapack_int *const iwork = new lapack_int[rows];
|
||||
auto *const work = new double[4*rows];
|
||||
auto *const iwork = new lapack_int[rows];
|
||||
double norm1 = getNorm1();
|
||||
dgecon("1", &rows2, inv.base(), &rows2, &norm1, &rcond1,
|
||||
work, iwork, &info);
|
||||
|
|
|
@ -49,8 +49,8 @@ SymSchurDecomp::SymSchurDecomp(const GeneralMatrix &mata)
|
|||
lwork = (int) tmpwork;
|
||||
liwork = tmpiwork;
|
||||
// allocate work arrays
|
||||
double *work = new double[lwork];
|
||||
lapack_int *iwork = new lapack_int[liwork];
|
||||
auto *work = new double[lwork];
|
||||
auto *iwork = new lapack_int[liwork];
|
||||
|
||||
// do the calculation
|
||||
dsyevr(jobz, range, uplo, &n, a, &lda, vl, vu, il, iu, &abstol,
|
||||
|
|
|
@ -35,7 +35,7 @@ extern "C" {
|
|||
if (nhrs != 5 || nlhs > 3 || nlhs < 2)
|
||||
DYN_MEX_FUNC_ERR_MSG_TXT("Gensylv: Must have exactly 5 input args and either 2 or 3 output args.");
|
||||
|
||||
int order = (int) mxGetScalar(prhs[0]);
|
||||
auto order = (int) mxGetScalar(prhs[0]);
|
||||
const mxArray *const A = prhs[1];
|
||||
const mxArray *const B = prhs[2];
|
||||
const mxArray *const C = prhs[3];
|
||||
|
|
|
@ -46,7 +46,7 @@ OrdSequence::operator==(const OrdSequence &s) const
|
|||
void
|
||||
OrdSequence::add(int i)
|
||||
{
|
||||
vector<int>::iterator vit = data.begin();
|
||||
auto vit = data.begin();
|
||||
while (vit != data.end() && *vit < i)
|
||||
++vit;
|
||||
if (vit != data.end() && *vit == i)
|
||||
|
@ -57,7 +57,7 @@ OrdSequence::add(int i)
|
|||
void
|
||||
OrdSequence::add(const OrdSequence &s)
|
||||
{
|
||||
vector<int>::const_iterator vit = s.data.begin();
|
||||
auto vit = s.data.begin();
|
||||
while (vit != s.data.end())
|
||||
{
|
||||
add(*vit);
|
||||
|
@ -69,7 +69,7 @@ OrdSequence::add(const OrdSequence &s)
|
|||
bool
|
||||
OrdSequence::has(int i) const
|
||||
{
|
||||
vector<int>::const_iterator vit = data.begin();
|
||||
auto vit = data.begin();
|
||||
while (vit != data.end())
|
||||
{
|
||||
if (*vit == i)
|
||||
|
@ -133,8 +133,8 @@ Equivalence::Equivalence(const Equivalence &e, int i1, int i2)
|
|||
: n(e.n),
|
||||
classes(e.classes)
|
||||
{
|
||||
seqit s1 = find(i1);
|
||||
seqit s2 = find(i2);
|
||||
auto s1 = find(i1);
|
||||
auto s2 = find(i2);
|
||||
if (s1 != s2)
|
||||
{
|
||||
OrdSequence ns(*s1);
|
||||
|
@ -171,7 +171,7 @@ Equivalence::operator==(const Equivalence &e) const
|
|||
Equivalence::const_seqit
|
||||
Equivalence::findHaving(int i) const
|
||||
{
|
||||
const_seqit si = classes.begin();
|
||||
auto si = classes.begin();
|
||||
while (si != classes.end())
|
||||
{
|
||||
if ((*si).has(i))
|
||||
|
@ -186,7 +186,7 @@ Equivalence::findHaving(int i) const
|
|||
Equivalence::seqit
|
||||
Equivalence::findHaving(int i)
|
||||
{
|
||||
seqit si = classes.begin();
|
||||
auto si = classes.begin();
|
||||
while (si != classes.end())
|
||||
{
|
||||
if ((*si).has(i))
|
||||
|
@ -203,7 +203,7 @@ Equivalence::findHaving(int i)
|
|||
Equivalence::const_seqit
|
||||
Equivalence::find(int j) const
|
||||
{
|
||||
const_seqit si = classes.begin();
|
||||
auto si = classes.begin();
|
||||
int i = 0;
|
||||
while (si != classes.end() && i < j)
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ Equivalence::find(int j) const
|
|||
Equivalence::seqit
|
||||
Equivalence::find(int j)
|
||||
{
|
||||
seqit si = classes.begin();
|
||||
auto si = classes.begin();
|
||||
int i = 0;
|
||||
while (si != classes.end() && i < j)
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ Equivalence::find(int j)
|
|||
void
|
||||
Equivalence::insert(const OrdSequence &s)
|
||||
{
|
||||
seqit si = classes.begin();
|
||||
auto si = classes.begin();
|
||||
while (si != classes.end() && *si < s)
|
||||
++si;
|
||||
classes.insert(si, s);
|
||||
|
@ -251,7 +251,7 @@ Equivalence::trace(IntSequence &out, int num) const
|
|||
{
|
||||
int i = 0;
|
||||
int nc = 0;
|
||||
for (const_seqit it = begin(); it != end() && nc < num; ++it, ++nc)
|
||||
for (auto it = begin(); it != end() && nc < num; ++it, ++nc)
|
||||
for (int j = 0; j < (*it).length(); j++, i++)
|
||||
{
|
||||
TL_RAISE_IF(i >= out.size(),
|
||||
|
@ -270,7 +270,7 @@ Equivalence::trace(IntSequence &out, const Permutation &per) const
|
|||
int i = 0;
|
||||
for (int iclass = 0; iclass < numClasses(); iclass++)
|
||||
{
|
||||
const_seqit itper = find(per.getMap()[iclass]);
|
||||
auto itper = find(per.getMap()[iclass]);
|
||||
for (int j = 0; j < (*itper).length(); j++, i++)
|
||||
out[i] = (*itper)[j];
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void
|
|||
Equivalence::print(const char *prefix) const
|
||||
{
|
||||
int i = 0;
|
||||
for (const_seqit it = classes.begin();
|
||||
for (auto it = classes.begin();
|
||||
it != classes.end();
|
||||
++it, i++)
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ EquivalenceSet::EquivalenceSet(int num)
|
|||
bool
|
||||
EquivalenceSet::has(const Equivalence &e) const
|
||||
{
|
||||
list<Equivalence>::const_reverse_iterator rit = equis.rbegin();
|
||||
auto rit = equis.rbegin();
|
||||
while (rit != equis.rend() && *rit != e)
|
||||
++rit;
|
||||
if (rit != equis.rend())
|
||||
|
@ -385,7 +385,7 @@ EquivalenceSet::print(const char *prefix) const
|
|||
strcpy(tmp, prefix);
|
||||
strcat(tmp, " ");
|
||||
int i = 0;
|
||||
for (list<Equivalence>::const_iterator it = equis.begin();
|
||||
for (auto it = equis.begin();
|
||||
it != equis.end();
|
||||
++it, i++)
|
||||
{
|
||||
|
|
|
@ -184,9 +184,9 @@ FGSTensor::FGSTensor(const FSSparseTensor &t, const IntSequence &ss,
|
|||
}
|
||||
|
||||
zeros();
|
||||
FSSparseTensor::const_iterator lbi = t.getMap().lower_bound(lb);
|
||||
FSSparseTensor::const_iterator ubi = t.getMap().upper_bound(ub);
|
||||
for (FSSparseTensor::const_iterator run = lbi; run != ubi; ++run)
|
||||
auto lbi = t.getMap().lower_bound(lb);
|
||||
auto ubi = t.getMap().upper_bound(ub);
|
||||
for (auto run = lbi; run != ubi; ++run)
|
||||
{
|
||||
if (lb.lessEq((*run).first) && (*run).first.lessEq(ub))
|
||||
{
|
||||
|
|
|
@ -306,7 +306,7 @@ KronProdAll::mult(const ConstTwoDMatrix &in, TwoDMatrix &out) const
|
|||
{
|
||||
KronProdIAI interkron(*this, i);
|
||||
c = interkron.kpd.ncols();
|
||||
TwoDMatrix *newlast = new TwoDMatrix(in.nrows(), c);
|
||||
auto *newlast = new TwoDMatrix(in.nrows(), c);
|
||||
interkron.mult(*last, *newlast);
|
||||
delete last;
|
||||
last = newlast;
|
||||
|
@ -355,7 +355,7 @@ KronProdAll::multRows(const IntSequence &irows) const
|
|||
row = new ConstVector(irows[j], *(matlist[j]));
|
||||
else
|
||||
{
|
||||
Vector *aux = new Vector(ncols(j));
|
||||
auto *aux = new Vector(ncols(j));
|
||||
aux->zeros();
|
||||
(*aux)[irows[j]] = 1.0;
|
||||
to_delete.push_back(aux);
|
||||
|
|
|
@ -27,20 +27,20 @@ UNormalMoments::generateMoments(int maxdim, const TwoDMatrix &v)
|
|||
"Variance-covariance matrix is not square in UNormalMoments constructor");
|
||||
|
||||
int nv = v.nrows();
|
||||
URSingleTensor *mom2 = new URSingleTensor(nv, 2);
|
||||
auto *mom2 = new URSingleTensor(nv, 2);
|
||||
mom2->getData() = v.getData();
|
||||
insert(mom2);
|
||||
URSingleTensor *kronv = new URSingleTensor(nv, 2);
|
||||
auto *kronv = new URSingleTensor(nv, 2);
|
||||
kronv->getData() = v.getData();
|
||||
for (int d = 4; d <= maxdim; d += 2)
|
||||
{
|
||||
URSingleTensor *newkronv = new URSingleTensor(nv, d);
|
||||
auto *newkronv = new URSingleTensor(nv, d);
|
||||
KronProd::kronMult(ConstVector(v.getData()),
|
||||
ConstVector(kronv->getData()),
|
||||
newkronv->getData());
|
||||
delete kronv;
|
||||
kronv = newkronv;
|
||||
URSingleTensor *mom = new URSingleTensor(nv, d);
|
||||
auto *mom = new URSingleTensor(nv, d);
|
||||
// apply $F_n$ to |kronv|
|
||||
/* Here we go through all equivalences, select only those having 2
|
||||
elements in each class, then go through all elements in |kronv| and
|
||||
|
@ -94,7 +94,7 @@ FNormalMoments::FNormalMoments(const UNormalMoments &moms)
|
|||
{
|
||||
for (const auto & mom : moms)
|
||||
{
|
||||
FRSingleTensor *fm = new FRSingleTensor(*(mom.second));
|
||||
auto *fm = new FRSingleTensor(*(mom.second));
|
||||
insert(fm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ FTensor &
|
|||
UPSTensor::fold() const
|
||||
{
|
||||
TL_RAISE("Never should come to this place in UPSTensor::fold");
|
||||
FFSTensor *nothing = new FFSTensor(0, 0, 0);
|
||||
auto *nothing = new FFSTensor(0, 0, 0);
|
||||
return *nothing;
|
||||
}
|
||||
|
||||
|
@ -171,11 +171,11 @@ UPSTensor::fillFromSparseOne(const FSSparseTensor &t, const IntSequence &ss,
|
|||
IntSequence c(run.getCoor());
|
||||
c.add(1, cum);
|
||||
c.sort();
|
||||
FSSparseTensor::const_iterator sl = t.getMap().lower_bound(c);
|
||||
auto sl = t.getMap().lower_bound(c);
|
||||
if (sl != t.getMap().end())
|
||||
{
|
||||
FSSparseTensor::const_iterator su = t.getMap().upper_bound(c);
|
||||
for (FSSparseTensor::const_iterator srun = sl; srun != su; ++srun)
|
||||
auto su = t.getMap().upper_bound(c);
|
||||
for (auto srun = sl; srun != su; ++srun)
|
||||
get((*srun).second.first, *run) = (*srun).second.second;
|
||||
}
|
||||
}
|
||||
|
@ -219,9 +219,9 @@ UPSTensor::fillFromSparseTwo(const FSSparseTensor &t, const IntSequence &ss,
|
|||
|
||||
Permutation unsort(coor);
|
||||
zeros();
|
||||
FSSparseTensor::const_iterator lbi = t.getMap().lower_bound(lb_srt);
|
||||
FSSparseTensor::const_iterator ubi = t.getMap().upper_bound(ub_srt);
|
||||
for (FSSparseTensor::const_iterator run = lbi; run != ubi; ++run)
|
||||
auto lbi = t.getMap().lower_bound(lb_srt);
|
||||
auto ubi = t.getMap().upper_bound(ub_srt);
|
||||
for (auto run = lbi; run != ubi; ++run)
|
||||
{
|
||||
if (lb_srt.lessEq((*run).first) && (*run).first.lessEq(ub_srt))
|
||||
{
|
||||
|
@ -320,7 +320,7 @@ UTensor &
|
|||
FPSTensor::unfold() const
|
||||
{
|
||||
TL_RAISE("Unfolding of FPSTensor not implemented");
|
||||
UFSTensor *nothing = new UFSTensor(0, 0, 0);
|
||||
auto *nothing = new UFSTensor(0, 0, 0);
|
||||
return *nothing;
|
||||
}
|
||||
|
||||
|
@ -383,12 +383,12 @@ FPSTensor::FPSTensor(const TensorDimens &td, const Equivalence &e, const Permuta
|
|||
{
|
||||
Tensor::index fold_ind = dummy.getFirstIndexOf(run);
|
||||
const IntSequence &c = fold_ind.getCoor();
|
||||
GSSparseTensor::const_iterator sl = a.getMap().lower_bound(c);
|
||||
auto sl = a.getMap().lower_bound(c);
|
||||
if (sl != a.getMap().end())
|
||||
{
|
||||
Vector *row_prod = kp.multRows(run.getCoor());
|
||||
GSSparseTensor::const_iterator su = a.getMap().upper_bound(c);
|
||||
for (GSSparseTensor::const_iterator srun = sl; srun != su; ++srun)
|
||||
auto su = a.getMap().upper_bound(c);
|
||||
for (auto srun = sl; srun != su; ++srun)
|
||||
{
|
||||
Vector out_row((*srun).second.first, *this);
|
||||
out_row.add((*srun).second.second, *row_prod);
|
||||
|
|
|
@ -89,10 +89,10 @@ IrregTensor::IrregTensor(const IrregTensorHeader &h)
|
|||
return;
|
||||
}
|
||||
|
||||
Vector *last = new Vector(*(header.cols[header.dimen()-1]));
|
||||
auto *last = new Vector(*(header.cols[header.dimen()-1]));
|
||||
for (int i = header.dimen()-2; i > 0; i--)
|
||||
{
|
||||
Vector *newlast = new Vector(last->length()*header.cols[i]->length());
|
||||
auto *newlast = new Vector(last->length()*header.cols[i]->length());
|
||||
KronProd::kronMult(ConstVector(*(header.cols[i])),
|
||||
ConstVector(*last), *newlast);
|
||||
delete last;
|
||||
|
|
|
@ -124,10 +124,10 @@ URSingleTensor::URSingleTensor(const vector<ConstVector> &cols)
|
|||
return;
|
||||
}
|
||||
|
||||
Vector *last = new Vector(cols[cols.size()-1]);
|
||||
auto *last = new Vector(cols[cols.size()-1]);
|
||||
for (int i = cols.size()-2; i > 0; i--)
|
||||
{
|
||||
Vector *newlast = new Vector(Tensor::power(nvar(), cols.size()-i));
|
||||
auto *newlast = new Vector(Tensor::power(nvar(), cols.size()-i));
|
||||
KronProd::kronMult(cols[i], ConstVector(*last), *newlast);
|
||||
delete last;
|
||||
last = newlast;
|
||||
|
@ -148,10 +148,10 @@ URSingleTensor::URSingleTensor(const ConstVector &v, int d)
|
|||
return;
|
||||
}
|
||||
|
||||
Vector *last = new Vector(v);
|
||||
auto *last = new Vector(v);
|
||||
for (int i = d-2; i > 0; i--)
|
||||
{
|
||||
Vector *newlast = new Vector(last->length()*v.length());
|
||||
auto *newlast = new Vector(last->length()*v.length());
|
||||
KronProd::kronMult(v, ConstVector(*last), *newlast);
|
||||
delete last;
|
||||
last = newlast;
|
||||
|
|
|
@ -19,11 +19,11 @@ SparseTensor::insert(const IntSequence &key, int r, double c)
|
|||
TL_RAISE_IF(!std::isfinite(c),
|
||||
"Insertion of non-finite value in SparseTensor::insert");
|
||||
|
||||
iterator first_pos = m.lower_bound(key);
|
||||
auto first_pos = m.lower_bound(key);
|
||||
|
||||
// check that pair |key| and |r| is unique
|
||||
iterator last_pos = m.upper_bound(key);
|
||||
for (iterator it = first_pos; it != last_pos; ++it)
|
||||
auto last_pos = m.upper_bound(key);
|
||||
for (auto it = first_pos; it != last_pos; ++it)
|
||||
if ((*it).second.first == r)
|
||||
{
|
||||
TL_RAISE("Duplicate <key, r> insertion in SparseTensor::insert");
|
||||
|
@ -43,7 +43,7 @@ bool
|
|||
SparseTensor::isFinite() const
|
||||
{
|
||||
bool res = true;
|
||||
const_iterator run = m.begin();
|
||||
auto run = m.begin();
|
||||
while (res && run != m.end())
|
||||
{
|
||||
if (!std::isfinite((*run).second.second))
|
||||
|
@ -60,7 +60,7 @@ double
|
|||
SparseTensor::getFoldIndexFillFactor() const
|
||||
{
|
||||
int cnt = 0;
|
||||
const_iterator start_col = m.begin();
|
||||
auto start_col = m.begin();
|
||||
while (start_col != m.end())
|
||||
{
|
||||
cnt++;
|
||||
|
@ -78,7 +78,7 @@ double
|
|||
SparseTensor::getUnfoldIndexFillFactor() const
|
||||
{
|
||||
int cnt = 0;
|
||||
const_iterator start_col = m.begin();
|
||||
auto start_col = m.begin();
|
||||
while (start_col != m.end())
|
||||
{
|
||||
const IntSequence &key = (*start_col).first;
|
||||
|
@ -96,14 +96,14 @@ void
|
|||
SparseTensor::print() const
|
||||
{
|
||||
printf("Fill: %3.2f %%\n", 100*getFillFactor());
|
||||
const_iterator start_col = m.begin();
|
||||
auto start_col = m.begin();
|
||||
while (start_col != m.end())
|
||||
{
|
||||
const IntSequence &key = (*start_col).first;
|
||||
printf("Column: "); key.print();
|
||||
const_iterator end_col = m.upper_bound(key);
|
||||
auto end_col = m.upper_bound(key);
|
||||
int cnt = 1;
|
||||
for (const_iterator run = start_col; run != end_col; ++run, cnt++)
|
||||
for (auto run = start_col; run != end_col; ++run, cnt++)
|
||||
{
|
||||
if ((cnt/7)*7 == cnt)
|
||||
printf("\n");
|
||||
|
@ -174,9 +174,9 @@ FSSparseTensor::multColumnAndAdd(const Tensor &t, Vector &v) const
|
|||
TL_RAISE_IF(key[0] < 0 || key[key.size()-1] >= nv,
|
||||
"Wrong coordinates of index in FSSparseTensor::multColumnAndAdd");
|
||||
|
||||
const_iterator first_pos = m.lower_bound(key);
|
||||
const_iterator last_pos = m.upper_bound(key);
|
||||
for (const_iterator cit = first_pos; cit != last_pos; ++cit)
|
||||
auto first_pos = m.lower_bound(key);
|
||||
auto last_pos = m.upper_bound(key);
|
||||
for (auto cit = first_pos; cit != last_pos; ++cit)
|
||||
{
|
||||
int r = (*cit).second.first;
|
||||
double c = (*cit).second.second;
|
||||
|
@ -215,9 +215,9 @@ GSSparseTensor::GSSparseTensor(const FSSparseTensor &t, const IntSequence &ss,
|
|||
ub[i] = s_offsets[coor[i]] + ss[coor[i]] - 1;
|
||||
}
|
||||
|
||||
FSSparseTensor::const_iterator lbi = t.getMap().lower_bound(lb);
|
||||
FSSparseTensor::const_iterator ubi = t.getMap().upper_bound(ub);
|
||||
for (FSSparseTensor::const_iterator run = lbi; run != ubi; ++run)
|
||||
auto lbi = t.getMap().lower_bound(lb);
|
||||
auto ubi = t.getMap().upper_bound(ub);
|
||||
for (auto run = lbi; run != ubi; ++run)
|
||||
{
|
||||
if (lb.lessEq((*run).first) && (*run).first.lessEq(ub))
|
||||
{
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
len++;
|
||||
}
|
||||
|
||||
Vector *res = new Vector(len);
|
||||
auto *res = new Vector(len);
|
||||
i = 0;
|
||||
while (i < numStacks() && getType(i, s) == _Stype::matrix)
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace sthread
|
|||
void *
|
||||
posix_thread_function(void *c)
|
||||
{
|
||||
thread_traits<posix>::_Ctype *ct
|
||||
auto *ct
|
||||
= (thread_traits<posix>::_Ctype *)c;
|
||||
try
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ namespace sthread
|
|||
void *
|
||||
posix_detach_thread_function(void *c)
|
||||
{
|
||||
thread_traits<posix>::_Dtype *ct
|
||||
auto *ct
|
||||
= (thread_traits<posix>::_Dtype *)c;
|
||||
condition_counter<posix> *counter = ct->counter;
|
||||
try
|
||||
|
|
|
@ -301,7 +301,7 @@ namespace sthread
|
|||
mmval *
|
||||
get(const void *c, const char *id)
|
||||
{
|
||||
iterator it = _Tparent::find(mmkey(c, id));
|
||||
auto it = _Tparent::find(mmkey(c, id));
|
||||
if (it == _Tparent::end())
|
||||
return NULL;
|
||||
return &((*it).second);
|
||||
|
@ -314,7 +314,7 @@ namespace sthread
|
|||
void
|
||||
remove(const void *c, const char *id)
|
||||
{
|
||||
iterator it = _Tparent::find(mmkey(c, id));
|
||||
auto it = _Tparent::find(mmkey(c, id));
|
||||
if (it != _Tparent::end())
|
||||
this->erase(it);
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ namespace sthread
|
|||
run()
|
||||
{
|
||||
int mpt = max_parallel_threads;
|
||||
iterator it = tlist.begin();
|
||||
auto it = tlist.begin();
|
||||
while (it != tlist.end())
|
||||
{
|
||||
if (counter.waitForChange() < mpt)
|
||||
|
|
|
@ -128,7 +128,7 @@ InducedSymmetries::InducedSymmetries(const Equivalence &e, const Permutation &p,
|
|||
{
|
||||
for (int i = 0; i < e.numClasses(); i++)
|
||||
{
|
||||
Equivalence::const_seqit it = e.find(p.getMap()[i]);
|
||||
auto it = e.find(p.getMap()[i]);
|
||||
push_back(Symmetry(s, *it));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ UGSContainer::UGSContainer(const FGSContainer &c)
|
|||
{
|
||||
for (const auto & it : c)
|
||||
{
|
||||
UGSTensor *unfolded = new UGSTensor(*(it.second));
|
||||
auto *unfolded = new UGSTensor(*(it.second));
|
||||
insert(unfolded);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ FGSContainer::FGSContainer(const UGSContainer &c)
|
|||
{
|
||||
for (const auto & it : c)
|
||||
{
|
||||
FGSTensor *folded = new FGSTensor(*(it.second));
|
||||
auto *folded = new FGSTensor(*(it.second));
|
||||
insert(folded);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,9 +115,9 @@ public:
|
|||
TensorContainer(const TensorContainer<_Ttype> &c)
|
||||
: n(c.n), m(), ebundle(c.ebundle)
|
||||
{
|
||||
for (const_iterator it = c.m.begin(); it != c.m.end(); ++it)
|
||||
for (auto it = c.m.begin(); it != c.m.end(); ++it)
|
||||
{
|
||||
_Ttype *ten = new _Ttype(*((*it).second));
|
||||
auto *ten = new _Ttype(*((*it).second));
|
||||
insert(ten);
|
||||
}
|
||||
}
|
||||
|
@ -128,9 +128,9 @@ public:
|
|||
TensorContainer(int first_row, int num, TensorContainer<_Ttype> &c)
|
||||
: n(c.n), ebundle(*(tls.ebundle))
|
||||
{
|
||||
for (iterator it = c.m.begin(); it != c.m.end(); ++it)
|
||||
for (auto it = c.m.begin(); it != c.m.end(); ++it)
|
||||
{
|
||||
_Ttype *t = new _Ttype(first_row, num, *((*it).second));
|
||||
auto *t = new _Ttype(first_row, num, *((*it).second));
|
||||
insert(t);
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
{
|
||||
TL_RAISE_IF(s.num() != num(),
|
||||
"Incompatible symmetry lookup in TensorContainer::get");
|
||||
const_iterator it = m.find(s);
|
||||
auto it = m.find(s);
|
||||
if (it == m.end())
|
||||
{
|
||||
TL_RAISE("Symmetry not found in TensorContainer::get");
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
{
|
||||
TL_RAISE_IF(s.num() != num(),
|
||||
"Incompatible symmetry lookup in TensorContainer::get");
|
||||
iterator it = m.find(s);
|
||||
auto it = m.find(s);
|
||||
if (it == m.end())
|
||||
{
|
||||
TL_RAISE("Symmetry not found in TensorContainer::get");
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
{
|
||||
TL_RAISE_IF(s.num() != num(),
|
||||
"Incompatible symmetry lookup in TensorContainer::check");
|
||||
const_iterator it = m.find(s);
|
||||
auto it = m.find(s);
|
||||
return it != m.end();
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
void
|
||||
remove(const Symmetry &s)
|
||||
{
|
||||
iterator it = m.find(s);
|
||||
auto it = m.find(s);
|
||||
if (it != m.end())
|
||||
{
|
||||
_ptr t = (*it).second;
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
getMaxDim() const
|
||||
{
|
||||
int res = -1;
|
||||
for (const_iterator run = m.begin(); run != m.end(); ++run)
|
||||
for (auto run = m.begin(); run != m.end(); ++run)
|
||||
{
|
||||
int dim = (*run).first.dimen();
|
||||
if (dim > res)
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
void
|
||||
writeMat(mat_t *fd, const char *prefix) const
|
||||
{
|
||||
for (const_iterator it = begin(); it != end(); ++it)
|
||||
for (auto it = begin(); it != end(); ++it)
|
||||
{
|
||||
char lname[100];
|
||||
sprintf(lname, "%s_g", prefix);
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
{
|
||||
vector<_const_ptr> res(e.numClasses());
|
||||
int i = 0;
|
||||
for (Equivalence::const_seqit it = e.begin();
|
||||
for (auto it = e.begin();
|
||||
it != e.end(); ++it, i++)
|
||||
{
|
||||
Symmetry s(rsym, *it);
|
||||
|
|
|
@ -12,7 +12,7 @@ PowerProvider::getNext(const URSingleTensor *dummy)
|
|||
{
|
||||
if (ut)
|
||||
{
|
||||
URSingleTensor *ut_new = new URSingleTensor(nv, ut->dimen()+1);
|
||||
auto *ut_new = new URSingleTensor(nv, ut->dimen()+1);
|
||||
KronProd::kronMult(ConstVector(origv), ConstVector(ut->getData()), ut_new->getData());
|
||||
delete ut;
|
||||
ut = ut_new;
|
||||
|
|
|
@ -294,7 +294,7 @@ public:
|
|||
}
|
||||
if (d > 1)
|
||||
{
|
||||
_Ttype *new_last = new _Ttype(*last, v);
|
||||
auto *new_last = new _Ttype(*last, v);
|
||||
delete last;
|
||||
last = new_last;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ public:
|
|||
TL_RAISE_IF(v.length() != nvars(),
|
||||
"Wrong length of vector for TensorPolynomial::evalPartially");
|
||||
|
||||
_Ttype *res = new _Ttype(nrows(), nvars(), s);
|
||||
auto *res = new _Ttype(nrows(), nvars(), s);
|
||||
res->zeros();
|
||||
|
||||
if (_Tparent::check(Symmetry(s)))
|
||||
|
@ -375,10 +375,10 @@ public:
|
|||
if (_Tparent::check(Symmetry(d)))
|
||||
{
|
||||
const _Ttype <mp = *(_Tparent::get(Symmetry(d)));
|
||||
_Ttype *last = new _Ttype(ltmp);
|
||||
auto *last = new _Ttype(ltmp);
|
||||
for (int j = 0; j < d - s; j++)
|
||||
{
|
||||
_Ttype *newlast = new _Ttype(*last, v);
|
||||
auto *newlast = new _Ttype(*last, v);
|
||||
delete last;
|
||||
last = newlast;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ ConstTwoDMatrix::writeMat(mat_t *fd, const char *vname) const
|
|||
#endif
|
||||
dims[0] = nrows();
|
||||
dims[1] = ncols();
|
||||
double *data = new double[nrows()*ncols()];
|
||||
auto *data = new double[nrows()*ncols()];
|
||||
|
||||
for (int j = 0; j < ncols(); j++)
|
||||
for (int i = 0; i < nrows(); i++)
|
||||
|
|
|
@ -46,7 +46,7 @@ Factory::makeVector(int n)
|
|||
{
|
||||
init(n, n*n);
|
||||
|
||||
Vector *v = new Vector(n);
|
||||
auto *v = new Vector(n);
|
||||
for (int i = 0; i < n; i++)
|
||||
(*v)[i] = get();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
_Ttype *
|
||||
make(int r, int nv, int dim)
|
||||
{
|
||||
_Ttype *res = new _Ttype(r, nv, dim);
|
||||
auto *res = new _Ttype(r, nv, dim);
|
||||
init(dim, nv);
|
||||
fillMatrix(*res);
|
||||
return res;
|
||||
|
@ -45,14 +45,14 @@ public:
|
|||
makeCont(int r, const IntSequence &nvs, int maxdim)
|
||||
{
|
||||
int symnum = nvs.size();
|
||||
_Ctype *res = new _Ctype(symnum);
|
||||
auto *res = new _Ctype(symnum);
|
||||
for (int dim = 1; dim <= maxdim; dim++)
|
||||
{
|
||||
if (symnum == 1)
|
||||
{
|
||||
// full symmetry
|
||||
Symmetry sym(dim);
|
||||
_Ttype *t = make<_Ttype>(r, sym, nvs);
|
||||
auto *t = make<_Ttype>(r, sym, nvs);
|
||||
res->insert(t);
|
||||
}
|
||||
else
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
for (int i = 0; i <= dim; i++)
|
||||
{
|
||||
Symmetry sym(i, dim-i);
|
||||
_Ttype *t = make<_Ttype>(r, sym, nvs);
|
||||
auto *t = make<_Ttype>(r, sym, nvs);
|
||||
res->insert(t);
|
||||
}
|
||||
}
|
||||
|
@ -73,10 +73,10 @@ public:
|
|||
_Ptype *
|
||||
makePoly(int r, int nv, int maxdim)
|
||||
{
|
||||
_Ptype *p = new _Ptype(r, nv);
|
||||
auto *p = new _Ptype(r, nv);
|
||||
for (int d = 1; d <= maxdim; d++)
|
||||
{
|
||||
_Ttype *t = make<_Ttype>(r, nv, d);
|
||||
auto *t = make<_Ttype>(r, nv, d);
|
||||
p->insert(t);
|
||||
}
|
||||
return p;
|
||||
|
|
|
@ -29,7 +29,7 @@ int
|
|||
IntGenerator::get() const
|
||||
{
|
||||
double d = drand48();
|
||||
int num_inter = (int) (((double) 2*maxim)/(1.0-probab));
|
||||
auto num_inter = (int) (((double) 2*maxim)/(1.0-probab));
|
||||
int num_zero_inter = num_inter - 2*maxim;
|
||||
if (d < ((double) num_zero_inter)/num_inter)
|
||||
return 0;
|
||||
|
@ -223,7 +223,7 @@ Monom2Vector::deriv(const Symmetry &s) const
|
|||
FGSContainer *
|
||||
Monom2Vector::deriv(int maxdim) const
|
||||
{
|
||||
FGSContainer *res = new FGSContainer(2);
|
||||
auto *res = new FGSContainer(2);
|
||||
for (int dim = 1; dim <= maxdim; dim++)
|
||||
{
|
||||
for (int ydim = 0; ydim <= dim; ydim++)
|
||||
|
@ -404,7 +404,7 @@ Monom4Vector::deriv(int dim) const
|
|||
IntSequence cum(4);
|
||||
cum[0] = 0; cum[1] = nx1; cum[2] = nx1+nx2; cum[3] = nx1+nx2+nx3;
|
||||
|
||||
FSSparseTensor *res = new FSSparseTensor(dim, nx1+nx2+nx3+nx4, len);
|
||||
auto *res = new FSSparseTensor(dim, nx1+nx2+nx3+nx4, len);
|
||||
|
||||
FFSTensor dummy(0, nx1+nx2+nx3+nx4, dim);
|
||||
for (Tensor::index run = dummy.begin(); run != dummy.end(); ++run)
|
||||
|
|
|
@ -225,7 +225,7 @@ TestRunnable::dense_prod(const Symmetry &bsym, const IntSequence &bnvs,
|
|||
Factory f;
|
||||
FGSContainer *cont
|
||||
= f.makeCont<FGSTensor, FGSContainer>(hnv, bnvs, bsym.dimen()-hdim+1);
|
||||
FGSTensor *fh
|
||||
auto *fh
|
||||
= f.make<FGSTensor>(rows, Symmetry(hdim), IntSequence(1, hnv));
|
||||
UGSTensor uh(*fh);
|
||||
FGSTensor fb(rows, TensorDimens(bsym, bnvs));
|
||||
|
@ -451,8 +451,8 @@ TestRunnable::folded_contraction(int r, int nv, int dim)
|
|||
Factory fact;
|
||||
Vector *x = fact.makeVector(nv);
|
||||
|
||||
FFSTensor *forig = fact.make<FFSTensor>(r, nv, dim);
|
||||
FFSTensor *f = new FFSTensor(*forig);
|
||||
auto *forig = fact.make<FFSTensor>(r, nv, dim);
|
||||
auto *f = new FFSTensor(*forig);
|
||||
clock_t ctime = clock();
|
||||
for (int d = dim-1; d > 0; d--)
|
||||
{
|
||||
|
@ -493,10 +493,10 @@ TestRunnable::unfolded_contraction(int r, int nv, int dim)
|
|||
Factory fact;
|
||||
Vector *x = fact.makeVector(nv);
|
||||
|
||||
FFSTensor *forig = fact.make<FFSTensor>(r, nv, dim);
|
||||
auto *forig = fact.make<FFSTensor>(r, nv, dim);
|
||||
UFSTensor uorig(*forig);
|
||||
delete forig;
|
||||
UFSTensor *u = new UFSTensor(uorig);
|
||||
auto *u = new UFSTensor(uorig);
|
||||
clock_t ctime = clock();
|
||||
for (int d = dim-1; d > 0; d--)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue