I've got the function below, taken from this thread: How to ensure two different vectors are shuffled in the same order in C++?
void Dataset::shuffle() {
std::random_device r;
std::seed_seq seed{r(), r(), r(), r(), r(), r(), r(), r()};
std::mt19937 eng1(seed);
auto eng2 = eng1;
std::shuffle(begin(items), end(items), eng1);
std::shuffle(begin(ids), end(ids), eng2);
}
I visualize the elements of the vectors as such (they are flattened matrices, 2D->1D):
trainData.items.at(0).show();
cout << "SHUFFLING" << endl;
trainData.shuffle();
trainData.items.at(0).show();
Here trainData is a class containing vectors (items), which contains a custom Matrix objects. So it's a vector of objects, inside another object (not sure if that correlates to the problem).
When using the show function in the first one, the matrix I get has proper values as it should such as:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 67 232 39 0 0 0 0 0
0 0 0 0 62 81 0 0 0 0 0 0 0 0 0 0 0 0 0 0 120 180 39 0 0 0 0 0
0 0 0 0 126 163 0 0 0 0 0 0 0 0 0 0 0 0 0 2 153 210 40 0 0 0 0 0
0 0 0 0 220 163 0 0 0 0 0 0 0 0 0 0 0 0 0 27 254 162 0 0 0 0 0 0
0 0 0 0 222 163 0 0 0 0 0 0 0 0 0 0 0 0 0 183 254 125 0 0 0 0 0 0
0 0 0 46 245 163 0 0 0 0 0 0 0 0 0 0 0 0 0 198 254 56 0 0 0 0 0 0
0 0 0 120 254 163 0 0 0 0 0 0 0 0 0 0 0 0 23 231 254 29 0 0 0 0 0 0
0 0 0 159 254 120 0 0 0 0 0 0 0 0 0 0 0 0 163 254 216 16 0 0 0 0 0 0
0 0 0 159 254 67 0 0 0 0 0 0 0 0 0 14 86 178 248 254 91 0 0 0 0 0 0 0
0 0 0 159 254 85 0 0 0 47 49 116 144 150 241 243 234 179 241 252 40 0 0 0 0 0 0 0
0 0 0 150 253 237 207 207 207 253 254 250 240 198 143 91 28 5 233 250 0 0 0 0 0 0 0 0
0 0 0 0 119 177 177 177 177 177 98 56 0 0 0 0 0 102 254 220 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 169 254 137 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 169 254 57 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 169 254 57 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 169 255 94 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 169 254 96 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 169 254 153 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 169 255 153 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 96 254 153 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Containing grayscale intensity values for an image.
After using the method above, it seems that the values have gotten destroyed (not necessarily the same matrix)
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
-1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18 -1.9984e+18
It seems to be working fine for integer values, but when I pass in a vector of objects, something goes wrong...
Aucun commentaire:
Enregistrer un commentaire