| 223 | } |
| 224 | |
| 225 | DataTable operator-(const DataTable &lhs, const DataTable &rhs) |
| 226 | { |
| 227 | if(lhs.getNumVariables() != rhs.getNumVariables()) { |
| 228 | throw Exception("operator-(DataTable, DataTable): trying to subtract two DataTable's of different dimensions!"); |
| 229 | } |
| 230 | |
| 231 | DataTable result; |
| 232 | auto rhsSamples = rhs.getSamples(); |
| 233 | // Add all samples from lhs that are not in rhs |
| 234 | for(auto it = lhs.cbegin(); it != lhs.cend(); it++) { |
| 235 | if(rhsSamples.count(*it) == 0) { |
| 236 | result.addSample(*it); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | return result; |
| 241 | } |
| 242 | |
| 243 | } // namespace SPLINTER |