Skip to content

Commit

Permalink
BQPD: replaced kktalphac with alphac + removed unused functions in un…
Browse files Browse the repository at this point in the history
…o/solvers/BQPD/wdotd.f
  • Loading branch information
cvanaret committed Nov 27, 2024
1 parent 811eb7a commit f7acb00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 39 deletions.
18 changes: 9 additions & 9 deletions uno/solvers/BQPD/BQPDSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@
#include "fortran_interface.h"

#define WSC FC_GLOBAL(wsc,WSC)
#define KKTALPHAC FC_GLOBAL(kktalphac,KKTALPHAC)
#define ALPHAC FC_GLOBAL(alphac,ALPHAC)
#define BQPD FC_GLOBAL(bqpd,BQPD)

namespace uno {
#define BIG 1e30

extern "C" {
extern "C" {
// fortran common block used in bqpd/bqpd.f
extern struct {
int kk, ll, kkk, lll, mxws, mxlws;
Expand All @@ -30,13 +27,16 @@ namespace uno {
// fortran common for inertia correction in wdotd
extern struct {
double alpha;
} KKTALPHAC;
} ALPHAC;

extern void
BQPD(const int* n, const int* m, int* k, int* kmax, double* a, int* la, double* x, double* bl, double* bu, double* f, double* fmin, double* g,
double* r, double* w, double* e, int* ls, double* alp, int* lp, int* mlp, int* peq, double* ws, int* lws, const int* mode, int* ifail,
int* info, int* iprint, int* nout);
}
}

namespace uno {
#define BIG 1e30

// preallocate a bunch of stuff
BQPDSolver::BQPDSolver(size_t number_variables, size_t number_constraints, size_t number_objective_gradient_nonzeros, size_t number_jacobian_nonzeros,
Expand Down Expand Up @@ -104,7 +104,7 @@ namespace uno {
WSC.ll = static_cast<int>(this->size_hessian_sparsity);
WSC.mxws = static_cast<int>(this->size_hessian_workspace);
WSC.mxlws = static_cast<int>(this->size_hessian_sparsity_workspace);
KKTALPHAC.alpha = 0; // inertia control
ALPHAC.alpha = 0; // inertia control

if (this->print_subproblem) {
DEBUG << "objective gradient: " << linear_objective;
Expand Down Expand Up @@ -311,4 +311,4 @@ namespace uno {
}
throw std::invalid_argument("The BQPD ifail is not consistent with the Uno status values");
}
} // namespace
} // namespace
31 changes: 1 addition & 30 deletions uno/solvers/BQPD/wdotd.f
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ subroutine wdotd (n, x, ws, lws, result)

c inertia control for diagonal terms
double precision alpha
common /kktalphac/ alpha
common /alphac/ alpha

c ======================== procedure body =========================

Expand Down Expand Up @@ -87,32 +87,3 @@ subroutine gdotx (n, x, ws, lws, result)

return
end
c ******************************************************************
subroutine saipy2(s,a,la,i,y,n)
implicit double precision (a-h,o-z)
dimension a(*),la(0:*),y(*)
c ======================== procedure body =========================
c saxpy with column i of A: y + s*A_{i, :}
if(s.eq.0.D0) return
j_column_start = la(0) + i
do j = la(j_column_start), la(j_column_start+1)-1
i_variable = la(j)
y(i_variable) = y(i_variable) + s*a(j)
enddo
return
end

c **************************** E N D *********************************
function daiscpr2(n,a,la,i,x,b)
implicit double precision (a-h,o-z)
dimension a(*),la(0:*),x(*)
DOUBLE PRECISION daiscpr2
c dot product of x and row i of A
daiscpr2 = dble(b)
j_column_start = la(0) + i
do j = la(j_column_start), la(j_column_start+1)-1
i_variable = la(j)
daiscpr2 = daiscpr2 + dble(x(i_variable))*dble(a(j))
enddo
return
end

0 comments on commit f7acb00

Please sign in to comment.