15 template <
class IT,
class NT>
20 pair<NT,NT>
getNoNum(IT index) {
return make_pair((NT) 0, (NT) 0); }
23 template <
typename c,
typename t>
24 pair<NT,NT>
read(std::basic_istream<c,t>& is, IT index)
27 is >> pp.first >> pp.second;
32 template <
typename c,
typename t>
33 void save(std::basic_ostream<c,t>& os,
const pair<NT,NT> & pp, IT index)
35 os << pp.first <<
"\t" << pp.second;
40 int main(
int argc,
char* argv[])
43 MPI_Init(&argc, &argv);
44 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
45 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
51 cout <<
"Usage: ./VectorIO <DictionaryVector> <UnPermutedVector> <OutputName> base(0 or 1)" << endl;
52 cout <<
"Example: ./VectorIO vertex_dict.mtx clusters.mtx original_clusters.mtx 0" << endl;
58 string vec1name(argv[1]);
59 string vec2name(argv[2]);
60 string voutname(argv[3]);
61 int base = atoi(argv[4]);
70 [](
string s1,
string s2) { cout <<
"Unexpected duplicate in dictionary" << endl;
return std::max<string>(s1, s2); });
73 [](
string s1,
string s2) { cout <<
"Unexpected duplicate in unpermuted vector" << endl;
return std::max<string>(s1, s2); });
76 clusters.
PrintInfo(
"unpermuted cluster vector");
82 clusters.
EWiseOut(vecdict, [] (
string s1,
string s2) {
return make_pair(s1,s2); }, newclusters);
void EWiseOut(const FullyDistVec< IT, NT > &rhs, _BinaryOperation __binary_op, FullyDistVec< IT, OUT > &result)
pair< NT, NT > read(std::basic_istream< c, t > &is, IT index)
pair< NT, NT > getNoNum(IT index)
void save(std::basic_ostream< c, t > &os, const pair< NT, NT > &pp, IT index)
int main(int argc, char *argv[])
void ParallelWrite(const std::string &filename, bool onebased, HANDLER handler, bool includeindices=true)
void PrintInfo(std::string vectorname) const
void ParallelRead(const std::string &filename, bool onebased, _BinaryOperation BinOp)