Skip to content

Commit

Permalink
remove infnorm update
Browse files Browse the repository at this point in the history
  • Loading branch information
galabovaa committed Oct 28, 2024
1 parent a755161 commit 95e8716
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 54 deletions.
35 changes: 0 additions & 35 deletions src/pdlp/cupdlp/cupdlp_linalg.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,27 +141,6 @@ double nrminf(cupdlp_int n, const double *x, cupdlp_int incx) {
#endif
}

cupdlp_int nrminfindex(cupdlp_int n, const double *x, cupdlp_int incx) {
#ifdef USE_MY_BLAS
assert(incx == 1);

double nrm = 0.0;
cupdlp_int index = 0;

for (int i = 0; i < n; ++i) {
double tmp = fabs(x[i]);
if (tmp > nrm) {
nrm = tmp;
index = i;
}
}

return index;
#else
return dnrminfindex(n, x, incx);
#endif
}

double twoNorm(double *x, cupdlp_int n) { return nrm2(n, x, 1); }

double twoNormSquared(double *x, cupdlp_int n) { return pow(twoNorm(x, n), 2); }
Expand Down Expand Up @@ -592,20 +571,6 @@ cupdlp_int cupdlp_twoNorm(CUPDLPwork *w, const cupdlp_int n,
return 0;
}

cupdlp_int cupdlp_infNormIndex(CUPDLPwork *w, const cupdlp_int n,
const cupdlp_float *x, cupdlp_int *res) {
#ifndef CUPDLP_CPU
#ifndef SFLOAT
CHECK_CUBLAS(cublasIdamax(w->cublashandle, n, x, 1, res));
#else
CHECK_CUBLAS(cublasIsamax(w->cublashandle, n, x, 1, res));
#endif
#else
*res = nrminfindex(n, x, 1);
#endif
return 0;
}

cupdlp_int cupdlp_scaleVector(CUPDLPwork *w, const cupdlp_float weight,
cupdlp_float *x, const cupdlp_int n) {
#ifndef CUPDLP_CPU
Expand Down
5 changes: 0 additions & 5 deletions src/pdlp/cupdlp/cupdlp_linalg.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ double twoNormSquared(double *x, cupdlp_int n);

double infNorm(double *x, cupdlp_int n);

cupdlp_int infNormIndex(double *x, cupdlp_int n);

/*------------------------ new added --------------------*/

double GenNorm(double *x, cupdlp_int n, cupdlp_float p);
Expand Down Expand Up @@ -116,9 +114,6 @@ cupdlp_int cupdlp_twoNorm(CUPDLPwork *w, const cupdlp_int n,
cupdlp_int cupdlp_infNorm(CUPDLPwork *w, const cupdlp_int n,
const cupdlp_float *x, cupdlp_float *res);

cupdlp_int cupdlp_infNormIndex(CUPDLPwork *w, const cupdlp_int n,
const cupdlp_float *x, cupdlp_int *res);

cupdlp_int cupdlp_scaleVector(CUPDLPwork *w, const cupdlp_float weight,
cupdlp_float *x, const cupdlp_int n);

Expand Down
16 changes: 2 additions & 14 deletions src/pdlp/cupdlp/cupdlp_solver.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ void PDHG_Compute_Primal_Feasibility(CUPDLPwork *work, double *primalResidual,
cupdlp_edot(primalResidual, work->rowScale, lp->nRows);
}

if (work->settings->iInfNormAbsLocalTermination) {
cupdlp_int index;
cupdlp_infNormIndex(work, lp->nRows, primalResidual, &index);
*dPrimalFeasibility = fabs(primalResidual[index]);
} else {
cupdlp_twoNorm(work, lp->nRows, primalResidual, dPrimalFeasibility);
}
cupdlp_twoNorm(work, lp->nRows, primalResidual, dPrimalFeasibility);
}

void PDHG_Compute_Dual_Feasibility(CUPDLPwork *work, double *dualResidual,
Expand Down Expand Up @@ -160,13 +154,7 @@ void PDHG_Compute_Dual_Feasibility(CUPDLPwork *work, double *dualResidual,
cupdlp_edot(dualResidual, work->colScale, lp->nCols);
}

if (work->settings->iInfNormAbsLocalTermination) {
cupdlp_int index;
cupdlp_infNormIndex(work, lp->nCols, dualResidual, &index);
*dDualFeasibility = fabs(dualResidual[index]);
} else {
cupdlp_twoNorm(work, lp->nCols, dualResidual, dDualFeasibility);
}
cupdlp_twoNorm(work, lp->nCols, dualResidual, dDualFeasibility);
}

void PDHG_Compute_Primal_Infeasibility(CUPDLPwork *work, const cupdlp_float *y,
Expand Down

0 comments on commit 95e8716

Please sign in to comment.