From 350b8bd3d1fb854637663c1a791f85db53feaa5d Mon Sep 17 00:00:00 2001 From: bbod Date: Mon, 30 Mar 2020 18:18:50 -0600 Subject: [PATCH] Auto Commit --- HW10/MakePermutationMatrix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HW10/MakePermutationMatrix.cpp b/HW10/MakePermutationMatrix.cpp index 3b614d9..8a1581f 100644 --- a/HW10/MakePermutationMatrix.cpp +++ b/HW10/MakePermutationMatrix.cpp @@ -12,6 +12,7 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou std::vector localCostVector; std::size_t offset = 12; std::size_t counter = 0; + int vectorOffset = (source.size()+1)/2; std::sort(source.begin(), source.end()); std::vector myPerm = source; std::vector nextPerm = source; @@ -33,7 +34,7 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou //std::rotate(nextPerm.begin(), nextPerm.begin()+(rank+1)*offset, nextPerm.end()); //rotate my perm. - std::rotate(myPerm.begin(), myPerm.begin()+offset*rank,myPerm.end()); + std::rotate(myPerm.begin(), myPerm.begin()+vectorOffset*rank,myPerm.end()); //std::cout << "source.last(): " << source[8].GetName() << std::endl; std::cout << "source: "; for(int i = 0; i < source.size(); i++){