Minor modification for documentation and not changing topology if not necessary
This commit is contained in:
parent
085530ab36
commit
9b46377062
5 changed files with 54 additions and 45 deletions
|
|
@ -34,29 +34,32 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
void paradiseo::smp::Hypercubic::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||
{
|
||||
//Check if the number of node is coherent with an hypercube
|
||||
assert((nbNode & (nbNode-1)) == 0);
|
||||
if(nbNode!=matrix.size())
|
||||
{
|
||||
//Check if the number of node is coherent with an hypercube
|
||||
assert((nbNode & (nbNode-1)) == 0);
|
||||
|
||||
unsigned power=0,i,j;
|
||||
while((nbNode & 1<<power) == 0)
|
||||
power++;
|
||||
|
||||
matrix.clear();
|
||||
matrix.resize(nbNode);
|
||||
unsigned power=0,i,j;
|
||||
while((nbNode & 1<<power) == 0)
|
||||
power++;
|
||||
|
||||
matrix.clear();
|
||||
matrix.resize(nbNode);
|
||||
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
|
||||
//Construction
|
||||
matrix[0][0] = false;
|
||||
for (unsigned dim = 1; dim <= power; dim ++)
|
||||
{
|
||||
int stepNbNode = 1<< (dim-1); //represents the number of nodes for the current step.
|
||||
for(i=0; i <stepNbNode; i++)
|
||||
for(j=0; j< stepNbNode;j++)
|
||||
{
|
||||
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j];//Diagonal part
|
||||
matrix[i][j+stepNbNode]= matrix[i+stepNbNode][j] = (i == j);//Identity
|
||||
}
|
||||
//Construction
|
||||
matrix[0][0] = false;
|
||||
for (unsigned dim = 1; dim <= power; dim ++)
|
||||
{
|
||||
int stepNbNode = 1<< (dim-1); //represents the number of nodes for the current step.
|
||||
for(i=0; i <stepNbNode; i++)
|
||||
for(j=0; j< stepNbNode;j++)
|
||||
{
|
||||
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j];//Diagonal part
|
||||
matrix[i][j+stepNbNode]= matrix[i+stepNbNode][j] = (i == j);//Identity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue