Actual source code: bmrm.h

  1: #pragma once

  3: #include <petsc/private/taoimpl.h>

  5: #define BMRM_INFTY 1e30 /* single precision: ~\pm 10^{38.53}; PetscReal precision: ~\pm 10^{308.25} */
  6: #define ALPHA_MIN  1e-10
  7: #define ALPHA_MAX  1e10
  8: #define EPS_SV     1e-15
  9: #define EPS        1e-20
 10: #define TOL_LAM    1e-15
 11: #define TOL_R      1e-10
 12: #define INCRE_DIM  1000

 14: /* Context for BMRM solver */
 15: typedef struct {
 16:   VecScatter scatter; /* Scatter context  */
 17:   Vec        local_w;
 18:   PetscReal  lambda;
 19: } TAO_BMRM;

 21: typedef struct Vec_Chain {
 22:   Vec               V;
 23:   struct Vec_Chain *next;
 24: } Vec_Chain;

 26: /* Context for Dai-Fletcher solver */
 27: typedef struct {
 28:   PetscInt   maxProjIter;
 29:   PetscInt   maxPGMIter;
 30:   PetscInt  *ipt, *ipt2, *uv;
 31:   PetscReal *g, *y, *tempv, *d, *Qd, *t, *xplus, *tplus, *sk, *yk;

 33:   PetscInt dim;

 35:   PetscInt cur_num_cp;

 37:   /* Variables (i.e. Lagrangian multipliers) */
 38:   PetscReal *x;

 40:   /* Linear part of the objective function  */
 41:   PetscReal *f;

 43:   /* Hessian of the QP */
 44:   PetscReal **Q;

 46:   /* Constraint matrix  */
 47:   PetscReal *a;

 49:   /* RHS of the equality constraint */
 50:   PetscReal b;

 52:   /* Lower bound vector for the variables */
 53:   PetscReal *l;

 55:   /* Upper bound vector for the variables */
 56:   PetscReal *u;

 58:   /* Tolerance for optimization error */
 59:   PetscReal tol;
 60: } TAO_DF;