Fix compilation errors with GCC 4.7
parent
6103500543
commit
615535ad88
|
@ -217,7 +217,7 @@ void fillTensors(const _Tg& g, double sigma)
|
||||||
_Ttensym* g_yud = new _Ttensym(ypart.ny(), ypart.nys()+nu, d);
|
_Ttensym* g_yud = new _Ttensym(ypart.ny(), ypart.nys()+nu, d);
|
||||||
g_yud->zeros();
|
g_yud->zeros();
|
||||||
@<fill tensor of |g_yud| of dimension |d|@>;
|
@<fill tensor of |g_yud| of dimension |d|@>;
|
||||||
insert(g_yud);
|
this->insert(g_yud);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ void centralize(const DecisionRuleImpl& dr)
|
||||||
pol.derivative(d-1);
|
pol.derivative(d-1);
|
||||||
_Ttensym* der = pol.evalPartially(d, dstate);
|
_Ttensym* der = pol.evalPartially(d, dstate);
|
||||||
der->mult(1.0/dfac);
|
der->mult(1.0/dfac);
|
||||||
insert(der);
|
this->insert(der);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ void fillTensors(const _Tg& g, double sigma)
|
||||||
g_yd->add(mult, *ten);
|
g_yd->add(mult, *ten);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
insert(g_yd);
|
this->insert(g_yd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,10 +74,10 @@ public:@;
|
||||||
nvs[0] = fo.ypart.nys(); nvs[1] = fo.nu; nvs[2] = fo.nu; nvs[3] = 1;
|
nvs[0] = fo.ypart.nys(); nvs[1] = fo.nu; nvs[2] = fo.nu; nvs[3] = 1;
|
||||||
_Ttensor* ten = new _Ttensor(fo.ypart.ny(), TensorDimens(Symmetry(1,0,0,0),nvs));
|
_Ttensor* ten = new _Ttensor(fo.ypart.ny(), TensorDimens(Symmetry(1,0,0,0),nvs));
|
||||||
ten->zeros(); ten->add(1.0, fo.gy);
|
ten->zeros(); ten->add(1.0, fo.gy);
|
||||||
insert(ten);
|
this->insert(ten);
|
||||||
ten = new _Ttensor(fo.ypart.ny(), TensorDimens(Symmetry(0,1,0,0), nvs));
|
ten = new _Ttensor(fo.ypart.ny(), TensorDimens(Symmetry(0,1,0,0), nvs));
|
||||||
ten->zeros(); ten->add(1.0, fo.gu);
|
ten->zeros(); ten->add(1.0, fo.gu);
|
||||||
insert(ten);
|
this->insert(ten);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ IntegDerivs(int r, const IntSequence& nvs, const _Tgss& g, const __Tm& mom,
|
||||||
Symmetry sym(i,0,0,p);
|
Symmetry sym(i,0,0,p);
|
||||||
_Ttensor* ten = new _Ttensor(r, TensorDimens(sym, nvs));
|
_Ttensor* ten = new _Ttensor(r, TensorDimens(sym, nvs));
|
||||||
@<calculate derivative $h_{y^i\sigma^p}$@>;
|
@<calculate derivative $h_{y^i\sigma^p}$@>;
|
||||||
insert(ten);
|
this->insert(ten);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ symmetric polynomial. Note that the derivative get the true |nvs|.
|
||||||
IntSequence coor(sym, pp);
|
IntSequence coor(sym, pp);
|
||||||
_Ttensor* ten = new _Ttensor(*(g_int_cent.get(Symmetry(d))), ss, coor,
|
_Ttensor* ten = new _Ttensor(*(g_int_cent.get(Symmetry(d))), ss, coor,
|
||||||
TensorDimens(sym, true_nvs));
|
TensorDimens(sym, true_nvs));
|
||||||
insert(ten);
|
this->insert(ten);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ void remove(const void* c, const char* id)
|
||||||
{
|
{
|
||||||
iterator it = _Tparent::find(mmkey(c, id));
|
iterator it = _Tparent::find(mmkey(c, id));
|
||||||
if (it != _Tparent::end())
|
if (it != _Tparent::end())
|
||||||
erase(it);
|
this->erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ This is the |synchro| class. The constructor of this class tries to
|
@ This is the |synchro| class. The constructor of this class tries to
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2011 Dynare Team
|
* Copyright (C) 2010-2012 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -426,107 +426,6 @@ namespace mat
|
||||||
}
|
}
|
||||||
return nrm;
|
return nrm;
|
||||||
}
|
}
|
||||||
// emulates Matlab command A(a,b)=B(c,d) where a,b,c,d are size_t vectors or nullVec as a proxy for ":")
|
|
||||||
// i.e. zero sized vector (or mat::nullVec) is interpreted as if one supplied ":" in matlab
|
|
||||||
template<class Mat1, class Mat2>
|
|
||||||
void
|
|
||||||
assignByVectors(Mat1 &a, const std::vector<size_t> &vToRows, const std::vector<size_t> &vToCols,
|
|
||||||
const Mat2 &b, const std::vector<size_t> &vrows, const std::vector<size_t> &vcols)
|
|
||||||
{
|
|
||||||
size_t nrows = 0, ncols = 0, tonrows = 0, toncols = 0;
|
|
||||||
const std::vector<size_t> *vpToCols = 0, *vpToRows = 0, *vpRows = 0, *vpCols = 0;
|
|
||||||
std::vector<size_t> tmpvpToCols(0), tmpvpToRows(0), tmpvpRows(0), tmpvpCols(0);
|
|
||||||
|
|
||||||
if (vToRows.size() == 0 && vToCols.size() == 0 && vrows.size() == 0 && vcols.size() == 0)
|
|
||||||
a = b;
|
|
||||||
else if (vToRows.size() == 0 && vrows.size() == 0) // just reorder columns
|
|
||||||
reorderColumnsByVectors(a, vToCols, b, vcols);
|
|
||||||
else if (vToCols.size() == 0 && vcols.size() == 0) // just reorder rows
|
|
||||||
reorderRowsByVectors(a, vToRows, b, vrows);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (vToRows.size() == 0)
|
|
||||||
{
|
|
||||||
tonrows = a.getRows();
|
|
||||||
tmpvpToRows.reserve(tonrows);
|
|
||||||
for (size_t i = 0; i < tonrows; ++i)
|
|
||||||
tmpvpToRows[i] = i;
|
|
||||||
vpToRows = (const std::vector<size_t> *)&tmpvpToRows;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < vToRows.size(); ++i)
|
|
||||||
{
|
|
||||||
assert(vToRows[i] < a.getRows()); //Negative or too large indices
|
|
||||||
tonrows++;
|
|
||||||
}
|
|
||||||
assert(tonrows <= a.getRows()); // check wrong dimensions for assignment by vector
|
|
||||||
vpToRows = &vToRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vToCols.size() == 0)
|
|
||||||
{
|
|
||||||
toncols = a.getCols();
|
|
||||||
tmpvpToCols.reserve(toncols);
|
|
||||||
for (size_t i = 0; i < toncols; ++i)
|
|
||||||
tmpvpToCols[i] = i;
|
|
||||||
vpToCols = (const std::vector<size_t> *)&tmpvpToCols;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < vToCols.size(); ++i)
|
|
||||||
{
|
|
||||||
assert(vToCols[i] < a.getCols()); //Negative or too large indices
|
|
||||||
toncols++;
|
|
||||||
}
|
|
||||||
assert(toncols <= a.getCols()); // check wrong dimensions for assignment by vector
|
|
||||||
vpToCols = &vToCols;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vrows.size() == 0)
|
|
||||||
{
|
|
||||||
nrows = b.getRows();
|
|
||||||
tmpvpRows.reserve(nrows);
|
|
||||||
for (size_t i = 0; i < nrows; ++i)
|
|
||||||
tmpvpRows[i] = i;
|
|
||||||
vpRows = (const std::vector<size_t> *)&tmpvpRows;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < vrows.size(); ++i)
|
|
||||||
{
|
|
||||||
assert(vrows[i] < b.getRows()); //Negative or too large indices
|
|
||||||
nrows++;
|
|
||||||
}
|
|
||||||
assert(nrows <= b.getRows()); // check wrong dimensions for assignment by vector
|
|
||||||
vpRows = &vrows;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vcols.size() == 0)
|
|
||||||
{
|
|
||||||
ncols = b.getCols();
|
|
||||||
tmpvpCols.reserve(ncols);
|
|
||||||
for (size_t i = 0; i < ncols; ++i)
|
|
||||||
tmpvpCols[i] = i;
|
|
||||||
vpCols = (const std::vector<size_t> *)&tmpvpCols;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < vcols.size(); ++i)
|
|
||||||
{
|
|
||||||
assert(vcols[i] < b.getCols()); //Negative or too large indices
|
|
||||||
ncols++;
|
|
||||||
}
|
|
||||||
assert(ncols <= b.getCols()); // check wrong dimensions for assignment by vector
|
|
||||||
vpCols = &vcols;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(tonrows == nrows && toncols == ncols && nrows * ncols > 0);
|
|
||||||
for (size_t i = 0; i < nrows; ++i)
|
|
||||||
for (size_t j = 0; j < ncols; ++j)
|
|
||||||
a((*vpToRows)[i], (*vpToCols)[j]) = b((*vpRows)[i], (*vpCols)[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// emulates Matlab command A(:,b)=B(:,d) where b,d are size_t vectors or nullVec as a proxy for ":")
|
// emulates Matlab command A(:,b)=B(:,d) where b,d are size_t vectors or nullVec as a proxy for ":")
|
||||||
// i.e. zero sized vector (or mat::nullVec) is interpreted as if one supplied ":" in matlab
|
// i.e. zero sized vector (or mat::nullVec) is interpreted as if one supplied ":" in matlab
|
||||||
|
@ -649,6 +548,108 @@ namespace mat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// emulates Matlab command A(a,b)=B(c,d) where a,b,c,d are size_t vectors or nullVec as a proxy for ":")
|
||||||
|
// i.e. zero sized vector (or mat::nullVec) is interpreted as if one supplied ":" in matlab
|
||||||
|
template<class Mat1, class Mat2>
|
||||||
|
void
|
||||||
|
assignByVectors(Mat1 &a, const std::vector<size_t> &vToRows, const std::vector<size_t> &vToCols,
|
||||||
|
const Mat2 &b, const std::vector<size_t> &vrows, const std::vector<size_t> &vcols)
|
||||||
|
{
|
||||||
|
size_t nrows = 0, ncols = 0, tonrows = 0, toncols = 0;
|
||||||
|
const std::vector<size_t> *vpToCols = 0, *vpToRows = 0, *vpRows = 0, *vpCols = 0;
|
||||||
|
std::vector<size_t> tmpvpToCols(0), tmpvpToRows(0), tmpvpRows(0), tmpvpCols(0);
|
||||||
|
|
||||||
|
if (vToRows.size() == 0 && vToCols.size() == 0 && vrows.size() == 0 && vcols.size() == 0)
|
||||||
|
a = b;
|
||||||
|
else if (vToRows.size() == 0 && vrows.size() == 0) // just reorder columns
|
||||||
|
reorderColumnsByVectors(a, vToCols, b, vcols);
|
||||||
|
else if (vToCols.size() == 0 && vcols.size() == 0) // just reorder rows
|
||||||
|
reorderRowsByVectors(a, vToRows, b, vrows);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (vToRows.size() == 0)
|
||||||
|
{
|
||||||
|
tonrows = a.getRows();
|
||||||
|
tmpvpToRows.reserve(tonrows);
|
||||||
|
for (size_t i = 0; i < tonrows; ++i)
|
||||||
|
tmpvpToRows[i] = i;
|
||||||
|
vpToRows = (const std::vector<size_t> *)&tmpvpToRows;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < vToRows.size(); ++i)
|
||||||
|
{
|
||||||
|
assert(vToRows[i] < a.getRows()); //Negative or too large indices
|
||||||
|
tonrows++;
|
||||||
|
}
|
||||||
|
assert(tonrows <= a.getRows()); // check wrong dimensions for assignment by vector
|
||||||
|
vpToRows = &vToRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vToCols.size() == 0)
|
||||||
|
{
|
||||||
|
toncols = a.getCols();
|
||||||
|
tmpvpToCols.reserve(toncols);
|
||||||
|
for (size_t i = 0; i < toncols; ++i)
|
||||||
|
tmpvpToCols[i] = i;
|
||||||
|
vpToCols = (const std::vector<size_t> *)&tmpvpToCols;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < vToCols.size(); ++i)
|
||||||
|
{
|
||||||
|
assert(vToCols[i] < a.getCols()); //Negative or too large indices
|
||||||
|
toncols++;
|
||||||
|
}
|
||||||
|
assert(toncols <= a.getCols()); // check wrong dimensions for assignment by vector
|
||||||
|
vpToCols = &vToCols;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vrows.size() == 0)
|
||||||
|
{
|
||||||
|
nrows = b.getRows();
|
||||||
|
tmpvpRows.reserve(nrows);
|
||||||
|
for (size_t i = 0; i < nrows; ++i)
|
||||||
|
tmpvpRows[i] = i;
|
||||||
|
vpRows = (const std::vector<size_t> *)&tmpvpRows;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < vrows.size(); ++i)
|
||||||
|
{
|
||||||
|
assert(vrows[i] < b.getRows()); //Negative or too large indices
|
||||||
|
nrows++;
|
||||||
|
}
|
||||||
|
assert(nrows <= b.getRows()); // check wrong dimensions for assignment by vector
|
||||||
|
vpRows = &vrows;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vcols.size() == 0)
|
||||||
|
{
|
||||||
|
ncols = b.getCols();
|
||||||
|
tmpvpCols.reserve(ncols);
|
||||||
|
for (size_t i = 0; i < ncols; ++i)
|
||||||
|
tmpvpCols[i] = i;
|
||||||
|
vpCols = (const std::vector<size_t> *)&tmpvpCols;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < vcols.size(); ++i)
|
||||||
|
{
|
||||||
|
assert(vcols[i] < b.getCols()); //Negative or too large indices
|
||||||
|
ncols++;
|
||||||
|
}
|
||||||
|
assert(ncols <= b.getCols()); // check wrong dimensions for assignment by vector
|
||||||
|
vpCols = &vcols;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(tonrows == nrows && toncols == ncols && nrows * ncols > 0);
|
||||||
|
for (size_t i = 0; i < nrows; ++i)
|
||||||
|
for (size_t j = 0; j < ncols; ++j)
|
||||||
|
a((*vpToRows)[i], (*vpToCols)[j]) = b((*vpRows)[i], (*vpCols)[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//emulates Matlab repmat: Mat2 = multv*multh tiled [Mat1]
|
//emulates Matlab repmat: Mat2 = multv*multh tiled [Mat1]
|
||||||
template<class Mat1, class Mat2 >
|
template<class Mat1, class Mat2 >
|
||||||
void
|
void
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#ifndef _WIN32
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ModFile.hh"
|
#include "ModFile.hh"
|
||||||
#include "ConfigFile.hh"
|
#include "ConfigFile.hh"
|
||||||
#include "ComputingTasks.hh"
|
#include "ComputingTasks.hh"
|
||||||
|
|
Loading…
Reference in New Issue