Actual source code: bmrm.h
1: #pragma once
3: #include <petsc/private/taoimpl.h>
4: #include <petscmath.h>
6: #define BMRM_INFTY 1e30 /* single precision: ~\pm 10^{38.53}; PetscReal precision: ~\pm 10^{308.25} */
7: #define ALPHA_MIN 1e-10
8: #define ALPHA_MAX 1e10
9: #define EPS_SV 1e-15
10: #define EPS 1e-20
11: #define TOL_LAM 1e-15
12: #define TOL_R 1e-10
13: #define INCRE_DIM 1000
15: /* Context for BMRM solver */
16: typedef struct {
17: VecScatter scatter; /* Scatter context */
18: Vec local_w;
19: PetscReal lambda;
20: } TAO_BMRM;
22: typedef struct Vec_Chain {
23: Vec V;
24: struct Vec_Chain *next;
25: } Vec_Chain;
27: /* Context for Dai-Fletcher solver */
28: typedef struct {
29: PetscInt maxProjIter;
30: PetscInt maxPGMIter;
31: PetscInt *ipt, *ipt2, *uv;
32: PetscReal *g, *y, *tempv, *d, *Qd, *t, *xplus, *tplus, *sk, *yk;
34: PetscInt dim;
36: PetscInt cur_num_cp;
38: /* Variables (i.e. Lagrangian multipliers) */
39: PetscReal *x;
41: /* Linear part of the objective function */
42: PetscReal *f;
44: /* Hessian of the QP */
45: PetscReal **Q;
47: /* Constraint matrix */
48: PetscReal *a;
50: /* RHS of the equality constraint */
51: PetscReal b;
53: /* Lower bound vector for the variables */
54: PetscReal *l;
56: /* Upper bound vector for the variables */
57: PetscReal *u;
59: /* Tolerance for optimization error */
60: PetscReal tol;
61: } TAO_DF;