From 5fdd7b9c694afd65dba24dd97653d5d2ee322e0c Mon Sep 17 00:00:00 2001 From: bbod Date: Mon, 30 Mar 2020 22:36:38 -0600 Subject: [PATCH] Auto Commit --- HW10/MakePermutationMatrix.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/HW10/MakePermutationMatrix.cpp b/HW10/MakePermutationMatrix.cpp index 8df2399..0505019 100644 --- a/HW10/MakePermutationMatrix.cpp +++ b/HW10/MakePermutationMatrix.cpp @@ -20,7 +20,9 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou returnVector.resize(source.size(), 0); //the "nextPerm" is the permutation to stop at. - std::rotate(nextPerm.begin(), nextPerm.begin()+(rank+1+vectorOffset), nextPerm.end()); + if(!rank) + std::rotate(nextPerm.begin(), nextPerm.begin() + (rank + 1 + vectorOffset), nextPerm.end()); + std::partial_sort(nextPerm.begin()+1, nextPerm.end(), nextPerm.end()); //rotate my perm. std::rotate(myPerm.begin(), myPerm.begin()+(rank+vectorOffset),myPerm.end());