1 #ifndef __TAO_MFQNLS_H 2 #define __TAO_MFQNLS_H 3 #include "petsc-private/taosolverimpl.h" 4 #include "petsc.h" 5 #include "petscblaslapack.h" 6 #include "taolapack.h" 7 8 9 typedef struct { 10 PetscInt npmax; /* Max number of interpolation points (>n+1) (def: 2n+1) */ 11 PetscInt nmax; /* Max(n*(n+1)/2, 5*npmax) */ 12 PetscInt m,n; 13 Vec *Xhist; 14 Vec *Fhist; 15 PetscReal *Fres; /* (nfmax) */ 16 PetscReal *RES; /* npxm */ 17 PetscReal *work; /* (n) */ 18 PetscReal *work2; /* (n) */ 19 PetscReal *work3; /* (n) */ 20 PetscReal *xmin; /* (n) */ 21 PetscReal *mwork; /* (m) */ 22 PetscReal *Disp; /* nxn */ 23 PetscReal *Fdiff;/* nxm */ 24 PetscReal *H; /* model hessians (mxnxn) */ 25 PetscReal *Hres; /* nxn */ 26 PetscReal *Gres; /* n */ 27 PetscReal *Gdel; /* mxn */ 28 PetscReal *Hdel; /* mxnxn */ 29 PetscReal *Gpoints; /* nxn */ 30 PetscReal *C; /* m */ 31 PetscReal *Xsubproblem; /* n */ 32 PetscInt *indices; /* 1,2,3...m */ 33 PetscInt minindex; 34 PetscInt nmodelpoints; 35 PetscInt *model_indices; /* n */ 36 PetscInt *interp_indices; /* n */ 37 PetscBLASInt *iwork; /* n */ 38 PetscInt nHist; 39 VecScatter scatterf,scatterx; 40 Vec localf, localx, localfmin, localxmin; 41 Vec workxvec; 42 PetscMPIInt size; 43 44 45 PetscReal delta; /* Trust region radius (>0) */ 46 PetscBool usegqt; 47 Mat Hs; 48 Vec b; 49 50 PetscReal deltamax; 51 PetscReal deltamin; 52 PetscReal c1; /* Factor for checking validity */ 53 PetscReal c2; /* Factor for linear poisedness */ 54 PetscReal theta1; /* Pivot threshold for validity */ 55 PetscReal theta2; /* Pivot threshold for additional points */ 56 PetscReal gamma0; /* parameter for shrinking trust region (<1) */ 57 PetscReal gamma1; /* parameter for enlarging trust region (>2) */ 58 PetscReal eta0; /* parameter 1 for accepting point (0 <= eta0 < eta1)*/ 59 PetscReal eta1; /* parameter 2 for accepting point (eta0 < eta1 < 1)*/ 60 PetscReal gqt_rtol; /* parameter used by gqt */ 61 PetscInt gqt_maxits; /* parameter used by gqt */ 62 /* QR factorization data */ 63 PetscInt q_is_I; 64 PetscReal *Q; /* npmax x npmax */ 65 PetscReal *Q_tmp; /* npmax x npmax */ 66 PetscReal *tau; /* scalar factors of H(i) */ 67 PetscReal *tau_tmp; /* scalar factors of H(i) */ 68 PetscReal *npmaxwork; /* work vector of length npmax */ 69 PetscBLASInt *npmaxiwork; /* integer work vector of length npmax */ 70 /* morepoints and getquadnlsmfq */ 71 PetscReal *L; /* n*(n+1)/2 x npmax */ 72 PetscReal *L_tmp; /* n*(n+1)/2 x npmax */ 73 PetscReal *L_save; /* n*(n+1)/2 x npmax */ 74 PetscReal *Z; /* npmax x npmax-(n+1) */ 75 PetscReal *M; /* npmax x n+1 */ 76 PetscReal *N; /* npmax x n*(n+1)/2 */ 77 PetscReal *alpha; /* n+1 */ 78 PetscReal *beta; /* r(n+1)/2 */ 79 PetscReal *omega; /* npmax - np - 1 */ 80 81 TaoSolver subtao; 82 Vec subxl,subxu,subx,subpdel,subndel,subb; 83 Mat subH; 84 85 } TAO_POUNDERS; 86 87 88 PetscErrorCode gqt(PetscInt n, PetscReal *a, PetscInt lda, PetscReal *b, PetscReal delta, PetscReal rtol, PetscReal atol, PetscInt itmax, PetscReal *par, PetscReal *f, PetscReal *x, PetscInt *info, PetscInt *its, PetscReal *z, PetscReal *wa1, PetscReal *wa2); 89 90 PetscErrorCode gqtwrap(TaoSolver tao,PetscReal *gnorm, PetscReal *qmin); 91 PetscErrorCode phi2eval(PetscReal *x, PetscInt n, PetscReal *phi); 92 PetscErrorCode getquadpounders(TAO_POUNDERS *mfqP); 93 PetscErrorCode morepoints(TAO_POUNDERS *mfqP); 94 PetscErrorCode addpoint(TaoSolver tao, TAO_POUNDERS *mfqP, PetscInt index); 95 PetscErrorCode modelimprove(TaoSolver tao, TAO_POUNDERS *mfqP, PetscInt addallpoints); 96 PetscErrorCode affpoints(TAO_POUNDERS *mfqP, PetscReal *xmin, PetscReal c); 97 98 EXTERN_C_BEGIN 99 void dgqt_(PetscInt *n, PetscReal *a, PetscInt *lda, PetscReal *b, PetscReal *delta, PetscReal *rtol, PetscReal *atol, PetscInt *itmax, PetscReal *par, PetscReal *f, PetscReal *x, PetscInt *info, int *its, PetscReal *z, PetscReal *wa1, PetscReal *wa2); 100 EXTERN_C_END 101 #endif /* ifndef __TAO_MFQNLS */ 102