Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

Mat* Impala::Core::Matrix::MatDrawRandomRows ( Mat *  data,
int  requestedSize 
)

Definition at line 18 of file MatDrawRandomRows.h.

References Impala::Util::Random::GetGlobal(), 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     std::random_shuffle(indices.begin(), indices.end(), Util::Random::GetGlobal());
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:


Generated on Thu Jan 13 09:20:12 2011 for ImpalaSrc by  doxygen 1.5.1