Actual source code: pounders.h

  1: #ifndef __TAO_MFQNLS_H
  3: #include "include/private/taosolver_impl.h"
  4: #include "petsc.h"
  5: #include "petscblaslapack.h"
  6: #include "taolapack.h"


  9: typedef struct {
 10:   PetscInt npmax;  /* Max number of interpolation points (>n+1) (def: 2n+1) */
 11:   PetscInt m,n;
 12:   Vec *Xhist;
 13:   Vec *Fhist;
 14:   PetscReal *Fres; /* (nfmax) */
 15:   PetscReal *RES; /* npxm */
 16:   PetscReal *work; /* (n) */
 17:   PetscReal *work2; /* (n) */
 18:   PetscReal *work3; /* (n) */
 19:   PetscReal *xmin; /* (n) */
 20:   PetscReal *mwork; /* (m) */
 21:   PetscReal *Disp; /* nxn */
 22:   PetscReal *Fdiff;/* nxm */
 23:   PetscReal *H; /* model hessians (mxnxn) */
 24:   PetscReal *Hres;  /* nxn */
 25:   PetscReal *Gres;  /* n */
 26:   PetscReal *Gdel; /* mxn */
 27:   PetscReal *Hdel; /* mxnxn */
 28:   PetscReal *Gpoints; /* nxn */
 29:   PetscReal *C; /* m */
 30:   PetscReal *Xsubproblem; /* n */
 31:   PetscInt *indices; /* 1,2,3...m */
 32:   PetscInt minindex;
 33:   PetscInt nmodelpoints;
 34:   PetscInt *model_indices; /* n */
 35:   PetscInt *interp_indices; /* n */
 36:   PetscBLASInt *iwork; /* n */
 37:   PetscInt nHist;
 38:   VecScatter scatterf,scatterx; 
 39:   Vec localf, localx, localfmin, localxmin;
 40:   Vec workxvec;
 41:   PetscMPIInt mpisize;


 44:   PetscReal delta; /* Trust region radius (>0) */
 45:   PetscBool usegqt;
 46:   Mat Hs;
 47:   Vec b;

 49:   PetscReal deltamax;
 50:   PetscReal deltamin;
 51:   PetscReal c1; /* Factor for checking validity */
 52:   PetscReal c2; /* Factor for linear poisedness */
 53:   PetscReal theta1; /* Pivot threshold for validity */
 54:   PetscReal theta2; /* Pivot threshold for additional points */
 55:   PetscReal gamma0; /* parameter for shrinking trust region (<1) */
 56:   PetscReal gamma1; /* parameter for enlarging trust region (>2) */
 57:   PetscReal eta0;   /* parameter 1 for accepting point (0 <= eta0 < eta1)*/
 58:   PetscReal eta1;   /* parameter 2 for accepting point (eta0 < eta1 < 1)*/
 59:   PetscReal gqt_rtol;   /* parameter used by gqt */
 60:   PetscInt gqt_maxits; /* parameter used by gqt */
 61:   /* QR factorization data */
 62:   PetscInt q_is_I;
 63:   PetscReal *Q; /* npmax x npmax */
 64:   PetscReal *Q_tmp; /* npmax x npmax */
 65:   PetscReal *tau; /* scalar factors of H(i) */
 66:   PetscReal *tau_tmp; /* scalar factors of H(i) */
 67:   PetscReal *npmaxwork; /* work vector of length npmax */
 68:   PetscBLASInt *npmaxiwork; /* integer work vector of length npmax */
 69:   /* morepoints and getquadnlsmfq */
 70:   PetscReal *L;   /* n*(n+1)/2 x npmax */
 71:   PetscReal *L_tmp;   /* n*(n+1)/2 x npmax */
 72:   PetscReal *L_save;   /* n*(n+1)/2 x npmax */
 73:   PetscReal *Z;   /* npmax x npmax-(n+1) */
 74:   PetscReal *M;   /* npmax x n+1 */
 75:   PetscReal *N;   /* npmax x n*(n+1)/2  */
 76:   PetscReal *alpha; /* n+1 */
 77:   PetscReal *beta; /*  r(n+1)/2 */
 78:   PetscReal *omega; /* npmax - np - 1 */

 80:   TaoSolver subtao;

 82:     
 83:        
 84: } TAO_POUNDERS;


 87: 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: PetscErrorCode gqtwrap(TaoSolver tao,PetscReal *gnorm, PetscReal *qmin);
 90: PetscErrorCode phi2eval(PetscReal *x, PetscInt n, PetscReal *phi);
 91: PetscErrorCode getquadpounders(TAO_POUNDERS *mfqP);
 92: PetscErrorCode morepoints(TAO_POUNDERS *mfqP);
 93: PetscErrorCode addpoint(TaoSolver tao, TAO_POUNDERS *mfqP, PetscInt index);
 94: PetscErrorCode modelimprove(TaoSolver tao, TAO_POUNDERS *mfqP, PetscInt addallpoints);
 95: PetscErrorCode affpoints(TAO_POUNDERS *mfqP, PetscReal *xmin, PetscReal c);

 98: 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: #endif /* ifndef __TAO_MFQNLS */