From 7addd07dc7a0f824fd8865a280419253509c97c2 Mon Sep 17 00:00:00 2001 From: bbod Date: Mon, 30 Mar 2020 22:22:26 -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 fbca922..0666c15 100644 --- a/HW10/MakePermutationMatrix.cpp +++ b/HW10/MakePermutationMatrix.cpp @@ -20,7 +20,8 @@ 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 != size) + 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());