41 template <
typename PARMAT>
51 int main(
int argc,
char* argv[])
54 MPI_Init(&argc, &argv);
55 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
56 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
62 cout <<
"Usage: ./FindSparse <BASEADDRESS> <Matrix>" << endl;
63 cout <<
"Input files should be under <BASEADDRESS> in appropriate format" << endl;
69 string directory(argv[1]);
70 string matrixname(argv[2]);
71 matrixname = directory+
"/"+matrixname;
74 shared_ptr<CommGrid> fullWorld;
75 fullWorld.reset(
new CommGrid(MPI_COMM_WORLD, 0, 0) );
77 PARDBMAT
A(fullWorld);
82 A.ReadDistribute(matrixname, 0);
84 A.Find(crow, ccol, cval);
85 PARDBMAT
B(A.getnrow(), A.getncol(), crow, ccol, cval);
89 SpParHelper::Print(
"Find and Sparse working correctly\n");
93 SpParHelper::Print(
"ERROR in Find(), go fix it!\n");
95 SpParHelper::Print(
"Rows array: \n");
98 SpParHelper::Print(
"Columns array: \n");
101 SpParHelper::Print(
"Values array: \n");
115 A.Find(rowsym, colsym, valsym);
118 A.Reduce(colsums,
Column, plus<double>(), 0.0);
122 #if defined(COMBBLAS_TR1) || defined(COMBBLAS_BOOST) || defined(NOTGNU) 123 vector< FullyDistVec<int,double> > vals2concat;
124 vals2concat.push_back(numcols);
125 vals2concat.push_back(colsums);
126 vals2concat.push_back(colsums);
127 vals2concat.push_back(valsym);
129 vector< FullyDistVec<int,double> > vals2concat{numcols, colsums, colsums, valsym};
137 firstcolrids.
iota(A.getncol(),1);
138 rowsym.
Apply(bind2nd(plus<int>(), 1));
140 #if defined(COMBBLAS_TR1) || defined(COMBBLAS_BOOST) || defined(NOTGNU) 141 vector< FullyDistVec<int,int> > rows2concat;
142 rows2concat.push_back(firstrowrids);
143 rows2concat.push_back(firstcolrids);
144 rows2concat.push_back(rowsym);
146 vector< FullyDistVec<int,int> > rows2concat{firstrowrids, firstcolrids, rowsym};
152 firstrowcids.
iota(A.getncol()+1,0);
154 colsym.
Apply(bind2nd(plus<int>(), 1));
156 #if defined(COMBBLAS_TR1) || defined(COMBBLAS_BOOST) || defined(NOTGNU) 157 vector< FullyDistVec<int,int> > cols2concat;
158 cols2concat.push_back(firstrowcids);
159 cols2concat.push_back(firstcolcids);
160 cols2concat.push_back(colsym);
162 vector< FullyDistVec<int,int> > cols2concat{firstrowcids, firstcolcids, colsym};
167 PARDBMAT M(A.getnrow()+1, A.getncol()+1, nrow, ncol, nval);
FullyDistVec< IT, NT > Concatenate(std::vector< FullyDistVec< IT, NT > > &vecs)
void iota(IT globalsize, NT first)
void PrintInfo(std::string vectorname) const
void Apply(_UnaryOperation __unary_op)
void Symmetricize(PARMAT &A)
int main(int argc, char *argv[])