|
|
|
@ -9,7 +9,7 @@ extern "C" {
|
|
|
|
|
|
|
|
|
|
psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[],
|
|
|
|
|
psb_d_t val[], psb_d_t diag[],
|
|
|
|
|
psb_d_t w[], psb_i_t mate[])
|
|
|
|
|
psb_d_t w[], psb_i_t mate[]);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
@ -31,20 +31,21 @@ psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[],
|
|
|
|
|
vector<NODE_T> mateNode;
|
|
|
|
|
NODE_T u,v;
|
|
|
|
|
VAL_T weight;
|
|
|
|
|
psb_i_t preprocess = atoi(argv[2]);
|
|
|
|
|
psb_i_t romaInput = atoi(argv[3]);
|
|
|
|
|
VAL_T lambda = atof(argv[4]);
|
|
|
|
|
psb_i_t preprocess = 0; // 0 no greedy 1 greedy
|
|
|
|
|
psb_i_t romaInput = 1; // 1 sequential 2 parallel
|
|
|
|
|
VAL_T lambda = 0.8; // positive real value
|
|
|
|
|
psb_d_t aii, ajj, aij, wii, wjj, tmp1, tmp2, minabs, edgnrm;
|
|
|
|
|
psb_i_t nt;
|
|
|
|
|
psb_i_t nt=1; // number of threads, got with 1 for testing purposes.
|
|
|
|
|
psb_d_t timeDiff;
|
|
|
|
|
MatchStat pstat;
|
|
|
|
|
double eps=1e-16;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fprintf(stderr,"Sanity check: %d %d \n",nr,nc);
|
|
|
|
|
for (i=1; i<nr; i++) {
|
|
|
|
|
for (j=irp[i-1]; j<irp[i]; j++) {
|
|
|
|
|
v = i-1; // I
|
|
|
|
|
u = ja[j-1]; // J
|
|
|
|
|
u = ja[j-1] - 1; // J
|
|
|
|
|
if (v>u) {
|
|
|
|
|
// Define Ahat entry
|
|
|
|
|
aij = val[j-1];
|
|
|
|
@ -56,7 +57,7 @@ psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[],
|
|
|
|
|
if (edgnrm > eps) {
|
|
|
|
|
weight = 1.0 - (2*1.0*aij*wii*wjj)/(aii*(wii*wii) + ajj*(wjj*wjj));
|
|
|
|
|
} else {
|
|
|
|
|
weight = 1e-16;
|
|
|
|
|
weight = eps;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
s.push_back(u);
|
|
|
|
@ -66,8 +67,6 @@ psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[],
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
runRomaWrapper(s,t,weights, nr, mateNode,preprocess,romaInput,lambda ,nt, pstat, timeDiff);
|
|
|
|
|
if (isz < nr) return(-1);
|
|
|
|
|
if (nz != nr) return(-2);
|
|
|
|
|
/* loop here only makes sense when nr==nz */
|
|
|
|
|
for (i=0; i< nr; i++) {
|
|
|
|
|
mate[i] = mateNode[i]+1;
|
|
|
|
|