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

void Impala::Application::Repository::DoKernelMatrix2SimilarityTable (  ) 

Definition at line 2878 of file mainRepository.cpp.

References Impala::atol(), Impala::Core::Table::Copy(), Impala::CmdOptions::GetArg(), Impala::Persistency::KernelMatrixLocator::GetContainer(), Impala::Persistency::KernelMatrixLocator::GetFeature(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), Impala::Persistency::KernelMatrixLocator::GetIsIndex(), GetKernelMatrixLocator(), Impala::CmdOptions::GetNrArg(), GetRawDataSet(), Impala::Persistency::KernelMatrixLocator::GetWalkType(), ILOG_INFO, ILOG_VAR, Impala::MakeString(), and Impala::Core::Column::SortDescendingTopN().

Referenced by mainRepository().

02879 {
02880     ILOG_VAR(Impala.Application.Repository.DoKernelMatrix2SimilarityTable);
02881     CmdOptions& options = CmdOptions::GetInstance();
02882 
02883     KernelMatrixLocator kLoc = GetKernelMatrixLocator(options, true);
02884     RawDataSet* dataSet = GetRawDataSet(options, true);
02885     KernelMatrix* mat = KernelMatrixRepository().Get(kLoc);
02886     int topN = 100;
02887     int a = 9;
02888     if (options.GetNrArg() > a)
02889     {
02890         topN = atol(options.GetArg(a++));
02891         ILOG_INFO("topN = " << topN);
02892     }
02893     int start = options.GetInt("start");
02894     int end = options.GetInt("end");
02895     if (end == -1)
02896         end = mat->NrRow();
02897 
02898     std::vector<String> names;
02899     for (int i=start ; i<end ; i++)
02900     {
02901         String name = "kernelRow_" + MakeString(i);
02902         names.push_back(name);
02903     }
02904     SimilarityTableSet simSet(names, topN);
02905     QuidTable* quidTab = simSet.GetQuidTable();
02906     for (int i=0 ; i<topN ; i++)
02907         quidTab->Add(0); // quids should not be used!
02908 
02909     std::vector<String> tmpNames;
02910     tmpNames.push_back("tmp");
02911     int rowSize = mat->NrCol();
02912     SimilarityTableSet tmpSet(tmpNames, rowSize);
02913     QuidTable* tmpQuidTab = tmpSet.GetQuidTable();
02914     Core::Table::Copy(tmpQuidTab, mat->GetQuids());
02915     SimilarityTableSet::SimTableType* tmpSimTab = tmpSet.GetSimTable(0);
02916     for (int i=start ; i<end ; i++)
02917     {
02918         Real64* simData = tmpSimTab->GetColumn1()->GetData();
02919         int res = mat->GetRow(i, simData, rowSize);
02920         tmpSimTab->SetSize(res);
02921 
02922         int tabNr = i - start;
02923         SimilarityTableSet::SimTableType* simTab = simSet.GetSimTable(tabNr);
02924         SimilarityTableSet::RankTableType* rankTab = simSet.GetRankTable(tabNr);
02925         simTab->SetSize(topN);
02926         rankTab->SetSize(topN);
02927         Core::Column::SortDescendingTopN(tmpQuidTab->GetColumn1(),
02928                                          tmpSimTab->GetColumn1(),
02929                                          rankTab->GetColumn1(),
02930                                          simTab->GetColumn1());
02931     }
02932     delete mat;
02933 
02934     SimilarityTableSetLocator sLoc(kLoc, kLoc.GetIsIndex(), kLoc.GetWalkType(),
02935                                    "kernel.txt", "direct", kLoc.GetFeature(),
02936                                    kLoc.GetContainer());
02937     SimilarityTableSetRepository().Add(sLoc, &simSet);
02938 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:15:50 2011 for ImpalaSrc by  doxygen 1.5.1