diff --git a/uno/solvers/BQPD/BQPDSolver.cpp b/uno/solvers/BQPD/BQPDSolver.cpp index 71a9bf01..482024c6 100644 --- a/uno/solvers/BQPD/BQPDSolver.cpp +++ b/uno/solvers/BQPD/BQPDSolver.cpp @@ -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; @@ -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, @@ -104,7 +104,7 @@ namespace uno { WSC.ll = static_cast(this->size_hessian_sparsity); WSC.mxws = static_cast(this->size_hessian_workspace); WSC.mxlws = static_cast(this->size_hessian_sparsity_workspace); - KKTALPHAC.alpha = 0; // inertia control + ALPHAC.alpha = 0; // inertia control if (this->print_subproblem) { DEBUG << "objective gradient: " << linear_objective; @@ -311,4 +311,4 @@ namespace uno { } throw std::invalid_argument("The BQPD ifail is not consistent with the Uno status values"); } -} // namespace +} // namespace \ No newline at end of file diff --git a/uno/solvers/BQPD/wdotd.f b/uno/solvers/BQPD/wdotd.f index e7ab5954..42221013 100644 --- a/uno/solvers/BQPD/wdotd.f +++ b/uno/solvers/BQPD/wdotd.f @@ -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 ========================= @@ -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