Definition at line 2941 of file mainRepository.cpp. References Impala::atol(), Impala::CmdOptions::GetArg(), Impala::Persistency::RepositoryInFileSystem::GetFile(), Impala::Persistency::RepositoryInFileSystem::GetInstance(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), GetKernelMatrixLocator(), Impala::CmdOptions::GetNrArg(), GetRawDataSet(), Impala::Persistency::File::GetWriteBuffer(), ILOG_INFO, ILOG_VAR, Impala::MakeString(), Impala::Util::IOBuffer::Puts(), Impala::Core::Column::SortDescendingTopN(), and Impala::Persistency::File::Valid(). Referenced by mainRepository(). 02942 { 02943 ILOG_VAR(Impala.Application.Repository.DoKernelMatrix2Text); 02944 CmdOptions& options = CmdOptions::GetInstance(); 02945 02946 KernelMatrixLocator kLoc = GetKernelMatrixLocator(options, true); 02947 RawDataSet* dataSet = GetRawDataSet(options, true); 02948 KernelMatrix* mat = KernelMatrixRepository().Get(kLoc); 02949 int topN = 100; 02950 int a = 9; 02951 if (options.GetNrArg() > a) 02952 { 02953 topN = atol(options.GetArg(a++)); 02954 ILOG_INFO("topN = " << topN); 02955 } 02956 int start = options.GetInt("start"); 02957 int end = options.GetInt("end"); 02958 if (end == -1) 02959 end = mat->NrRow(); 02960 02961 RepositoryInFileSystem& repFS = RepositoryInFileSystem::GetInstance(); 02962 String fName = dataSet->GetSetNameBase() + "_top" + MakeString(topN); 02963 if ((start != 0) || (end != mat->NrRow())) 02964 fName += "_rows" + MakeString(start) + "-" + MakeString(end); 02965 fName += ".txt"; 02966 FileLocator loc(fName); 02967 Persistency::File file = repFS.GetFile(loc, true, false); 02968 if (!file.Valid()) 02969 return; 02970 Util::IOBuffer* ioBuf = file.GetWriteBuffer(); 02971 if (!ioBuf) 02972 return; 02973 02974 int rowSize = mat->NrCol(); 02975 QuidTable* allQuids = mat->GetQuids(); 02976 SimilarityTableSet::SimTableType rowSims(rowSize); 02977 QuidTable topQuids(topN); 02978 SimilarityTableSet::SimTableType topSims(topN); 02979 ILOG_INFO("Processing " << start << "-" << end); 02980 for (int i=start ; i<end ; i++) 02981 { 02982 if (i % 100 == 0) 02983 ILOG_INFO("doing row " << i); 02984 Real64* simData = rowSims.GetColumn1()->GetData(); 02985 int res = mat->GetRow(i, simData, rowSize); 02986 rowSims.SetSize(res); 02987 02988 Core::Column::SortDescendingTopN(allQuids->GetColumn1(), 02989 rowSims.GetColumn1(), 02990 topQuids.GetColumn1(), 02991 topSims.GetColumn1()); 02992 String s = MakeString(i) + " : "; 02993 for (int j=0 ; j<topN ; j++) 02994 { 02995 Quid q = topQuids.Get1(j); 02996 int fileId = dataSet->GetFileIdOfQuid(q); 02997 String path = dataSet->GetAsPath(fileId); 02998 s += "\"" + path + "\", "; 02999 } 03000 ioBuf->Puts(s); 03001 } 03002 ILOG_INFO("Done"); 03003 delete ioBuf; 03004 delete mat; 03005 }
Here is the call graph for this function: ![]()
|