| 211 | // ---------------------------------------------------------------------------------------- |
| 212 | |
| 213 | void make_data ( |
| 214 | std::vector<sample_type>& samples, |
| 215 | std::vector<label_type>& labels |
| 216 | ) |
| 217 | { |
| 218 | // Make four different vectors. We will use them to make example assignments. |
| 219 | column_vector A(num_dims), B(num_dims), C(num_dims), D(num_dims); |
| 220 | A = 1,0,0; |
| 221 | B = 0,1,0; |
| 222 | C = 0,0,1; |
| 223 | D = 0,1,1; |
| 224 | |
| 225 | std::vector<column_vector> lhs; |
| 226 | std::vector<column_vector> rhs; |
| 227 | label_type mapping; |
| 228 | |
| 229 | // In all the assignments to follow, we will only say an element of the LHS |
| 230 | // matches an element of the RHS if the two are equal. So A matches with A, |
| 231 | // B with B, etc. But never A with C, for example. |
| 232 | // ------------------------ |
| 233 | |
| 234 | lhs.resize(3); |
| 235 | lhs[0] = A; |
| 236 | lhs[1] = B; |
| 237 | lhs[2] = C; |
| 238 | |
| 239 | rhs.resize(3); |
| 240 | rhs[0] = B; |
| 241 | rhs[1] = A; |
| 242 | rhs[2] = C; |
| 243 | |
| 244 | mapping.resize(3); |
| 245 | mapping[0] = 1; // lhs[0] matches rhs[1] |
| 246 | mapping[1] = 0; // lhs[1] matches rhs[0] |
| 247 | mapping[2] = 2; // lhs[2] matches rhs[2] |
| 248 | |
| 249 | samples.push_back(make_pair(lhs,rhs)); |
| 250 | labels.push_back(mapping); |
| 251 | |
| 252 | // ------------------------ |
| 253 | |
| 254 | lhs[0] = C; |
| 255 | lhs[1] = A; |
| 256 | lhs[2] = B; |
| 257 | |
| 258 | rhs[0] = A; |
| 259 | rhs[1] = B; |
| 260 | rhs[2] = D; |
| 261 | |
| 262 | mapping[0] = -1; // The -1 indicates that lhs[0] doesn't match anything in rhs. |
| 263 | mapping[1] = 0; // lhs[1] matches rhs[0] |
| 264 | mapping[2] = 1; // lhs[2] matches rhs[1] |
| 265 | |
| 266 | samples.push_back(make_pair(lhs,rhs)); |
| 267 | labels.push_back(mapping); |
| 268 | |
| 269 | // ------------------------ |
| 270 | |