t
This commit is contained in:
@@ -7,12 +7,12 @@
|
|||||||
namespace matrixTools
|
namespace matrixTools
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::vector<std::vector<T>> UnflattenMatrix(std::vector<T> origianlVector, int rowSize, int columnSize)
|
std::vector<std::vector<T>> UnflattenMatrix(std::vector<T> originalVector, int rowSize, int columnSize)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<T>> matrix(columnSize, std::vector<T>(rowSize, 0));
|
std::vector<std::vector<T>> matrix(columnSize, std::vector<T>(rowSize, 0));
|
||||||
for (int i = 0; i < columnSize; i++) {
|
for (int i = 0; i < columnSize; i++) {
|
||||||
for (int j = 0; j < rowSize; j++) {
|
for (int j = 0; j < rowSize; j++) {
|
||||||
matrix[i][j] = origianlVector[i + j];
|
matrix[i][j] = originalVector[i + j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matrix;
|
return matrix;
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ int main(int argc, char* argv[])
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
flatMatrix = matrixTools::FlattenMatrix(matrix);
|
flatMatrix = matrixTools::FlattenMatrix(matrix);
|
||||||
|
for(int i = 0; i < flatMatrix.size(); i++){
|
||||||
|
std::cout << flatMatrix[i] << " ";
|
||||||
|
}
|
||||||
|
std::cout<<std::endl;
|
||||||
}
|
}
|
||||||
MPI_Bcast(&citiesSize, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
MPI_Bcast(&citiesSize, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||||
if(rank){
|
if(rank){
|
||||||
|
|||||||
Reference in New Issue
Block a user