Scatter data to a pool by substraction, according to an index mapping */
| 230 | |
| 231 | /** Scatter data to a pool by substraction, according to an index mapping */ |
| 232 | void scatter_sub(std::vector<Data> &memory, const std::vector<Index> &mapping) { |
| 233 | if (!mapping.empty()) { |
| 234 | for (Index i = 0; i < count; i++) |
| 235 | memory[mapping[i]] -= host_ptr[i]; |
| 236 | } |
| 237 | else { |
| 238 | for (Index i = 0; i < count; i++) |
| 239 | memory[i] -= host_ptr[i]; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * @param capacity number of data |