Definition at line 18 of file MatDrawRandomRows.h. References Impala::Util::RandomGenerator::GetInstance(), MatKeepSpecificRows(), MatNrCol(), and MatNrRow(). Referenced by KmeansClustering(). 00019 { 00020 // data contains (n,d) d-D features 00021 int n = MatNrRow(data); 00022 int d = MatNrCol(data); 00023 std::vector<int> indices; 00024 for(int j = 0; j < n; j++) 00025 { 00026 indices.push_back(j); 00027 } 00028 Util::RandomGenerator::GetInstance().PermutateVector(indices); 00029 00030 std::vector<int> keepers; 00031 for(int j = 0; j < requestedSize; j++) 00032 { 00033 keepers.push_back(indices[j]); 00034 } 00035 std::sort(keepers.begin(), keepers.end()); 00036 00037 // we have the indices; now copy vectors 00038 return MatKeepSpecificRows(data, keepers); 00039 }
Here is the call graph for this function:
|