MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / getNZeroIndex

Function getNZeroIndex

Applications/HHL_Algorithm/BasicFunctionByOrigin.cpp:338–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338vector<int> getNZeroIndex(int* Sp, int size) {
339 //int size = Sp.size();
340 vector<vector<int>> N0index;
341 for (int i = 0; i < size; i++) {
342 N0index.push_back(No0Index[Sp[i]]);
343 }
344 vector<int> TotalIndex;
345 for (int i = 0; i < size; i++) {
346 for (int j = 0; j < N0index[i].size(); j++) {
347 TotalIndex.push_back(N0index[i][j]);
348 }
349 }
350 sort(TotalIndex.begin(), TotalIndex.end());
351 TotalIndex.erase(unique(TotalIndex.begin(), TotalIndex.end()), TotalIndex.end());
352 return TotalIndex;
353}
354
355vector<int> getNZeroIndexCol(vector<int>& Sp) {
356 int size = Sp.size();

Calls 6

sortFunction · 0.85
push_backMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected