Hi,
I'm having a problem resizing a (very big) nested vector. It's not the
most streamlined piece of code ever but I need this array to avoid
having to recalculate the same quantity millions of times!
The (relevant) snippets of code are below : since it's relevant though
L=28,T=96 (so TasteProps weighs in at a hefty
8*96*28*28*28*96=1,618,477,056 doubles [which I think requires 12G of
memory - I'm running on an 8GB machine : the problem??])
Can anyone suggest a more elegant solution? If inline calculation is
ruled out I'll have to resort to a lookup file rather than lookup in
memory - something I'd rather not have to deal with as I could quickly
fill up our departments home drive space!).
namespace PropLTable
{
vector< vector< vector< vector< double > > > > ScalarDisc(L),
VectorDisc(L), AxialDisc(L),
k2_lup(L);
vector<vector<vector<vector<vector<vector<double> > > > > >
TasteProps(8);
}
void resizenamespace()
{
using namespace PropLTable;
for (int i=0;i<L;i++)
{
ScalarDisc[i].resize(L);
VectorDisc[i].resize(L);
AxialDisc[i].resize(L);
k2_lup[i].resize(L);
for (int j = 0;j<L;i++)
{
ScalarDisc[i][j].resize(L);
VectorDisc[i][j].resize(L);
AxialDisc[i][j].resize(L);
k2_lup[i][j].resize(L);
for (int k = 0;k<L;k++)
{
ScalarDisc[i][j][k].resize(T);
VectorDisc[i][j][k].resize(T);
AxialDisc[i][j][k].resize(T);
k2_lup[i][j][k].resize(T);
}
}
}
for (int i = 0;i<8;i++)
{
TasteProps[i].resize(T);
for (int j = 0;j<T;j++)
{
TasteProps[i][j].resize(L);
for (int k = 0;k<L;k++)
{
TasteProps[i][j][k].resize(L);
for (int l = 0;l<L;l++)
{
TasteProps[i][j][k][l].resize(L);
for (int m = 0;m<L;m++)
{
TasteProps[i][j][k][l][m].resize(T);
}
}
}
}
}
}