avoid all zero

pull/3227/head
Yingying Wang 2020-06-08 16:18:11 -07:00
parent f18f1a35f6
commit 8fed101432
1 changed files with 7 additions and 0 deletions

View File

@ -251,6 +251,13 @@ size_t NZDiff(void *data, void *dataBase, size_t count, unsigned int numCompsIn,
vNZIdx.push_back(idx);
}
//avoid all-0, put 1 item
if (vNZDiff.size() == 0) {
for (unsigned int j = 0; j < numCompsOut; j++)
vNZDiff.push_back(0);
vNZIdx.push_back(0);
}
//process data
outputNZDiff = new T[vNZDiff.size()];
memcpy(outputNZDiff, vNZDiff.data(), vNZDiff.size() * sizeof(T));