Actual source code: petsctao.h

      1: #if !defined(PETSCTAO_H)
      2: #define PETSCTAO_H

      4: #include <petscsnes.h>

      6: PETSC_EXTERN PetscErrorCode VecFischer(Vec,Vec,Vec,Vec,Vec);
      7: PETSC_EXTERN PetscErrorCode VecSFischer(Vec,Vec,Vec,Vec,PetscReal,Vec);
      8: PETSC_EXTERN PetscErrorCode MatDFischer(Mat,Vec,Vec,Vec,Vec,Vec,Vec,Vec,Vec);
      9: PETSC_EXTERN PetscErrorCode MatDSFischer(Mat,Vec,Vec,Vec,Vec,PetscReal,Vec,Vec,Vec,Vec,Vec);
     10: PETSC_EXTERN PetscErrorCode TaoSoftThreshold(Vec,PetscReal,PetscReal,Vec);

     12: /*E
     13:   TaoSubsetType - PetscInt representing the way TAO handles active sets

     15: + TAO_SUBSET_SUBVEC - TAO uses PETSc's MatCreateSubMatrix and VecGetSubVector
     16: . TAO_SUBSET_MASK - Matrices are zeroed out corresponding to active set entries
     17: - TAO_SUBSET_MATRIXFREE - Same as TAO_SUBSET_MASK but it can be applied to matrix-free operators

     19:   Options database keys:
     20: . -different_hessian - TAO will use a copy of the hessian operator for masking.  By default
     21:                        TAO will directly alter the hessian operator.
     22:   Level: intermediate

     24: E*/

     26: typedef enum {TAO_SUBSET_SUBVEC,TAO_SUBSET_MASK,TAO_SUBSET_MATRIXFREE} TaoSubsetType;
     27: PETSC_EXTERN const char *const TaoSubsetTypes[];
     28: /*S
     29:      Tao - Abstract PETSc object that manages nonlinear optimization solves

     31:    Level: advanced

     33: .seealso TaoCreate(), TaoDestroy(), TaoSetType(), TaoType
     34: S*/

     36: /*E
     37:      TaoADMMUpdateType - Determine spectral penalty update routine for lagrange augmented term for ADMM.

     39:   Level: advanced

     41: .seealso TaoADMMSetUpdateType()
     42: E*/
     43: typedef enum {TAO_ADMM_UPDATE_BASIC,TAO_ADMM_UPDATE_ADAPTIVE,TAO_ADMM_UPDATE_ADAPTIVE_RELAXED} TaoADMMUpdateType;
     44: PETSC_EXTERN const char *const TaoADMMUpdateTypes[];
     45: /*MC
     46:      TAO_ADMM_UPDATE_BASIC - Use same spectral penalty set at the beginning. No update

     48:   Level: advanced

     50:   Note: Most basic implementation. Generally slower than adaptive or adaptive relaxed version.

     52: .seealso: TaoADMMSetUpdateType(), TAO_ADMM_UPDATE_ADAPTIVE, TAO_ADMM_UPDATE_ADAPTIVE_RELAXED
     53: M*/

     55: /*MC
     56:      TAO_ADMM_UPDATE_ADAPTIVE - Adaptively update spectral penalty

     58:   Level: advanced

     60:   Note: Adaptively updates spectral penalty by using both steepest descent and minimum gradient.

     62: .seealso: TaoADMMSetUpdateType(), TAO_ADMM_UPDATE_BASIC, TAO_ADMM_UPDATE_ADAPTIVE_RELAXED
     63: M*/

     65: /*MC
     66:      ADMM_UPDATE_ADAPTIVE_RELAXED - Adaptively update spectral penalty, and relaxes parameter update

     68:   Level: advanced

     70:   Note: With adaptive spectral penalty update, it also relaxes x vector update by a factor.

     72: .seealso: TaoADMMSetUpdateType(), TAO_ADMM_UPDATE_BASIC, TAO_ADMM_UPDATE_ADAPTIVE
     73: M*/

     75: /*E
     76:      TaoADMMRegularizerType - Determine regularizer routine - either user provided or soft threshold

     78:   Level: advanced

     80: .seealso TaoADMMSetRegularizerType()
     81: E*/
     82: typedef enum {TAO_ADMM_REGULARIZER_USER,TAO_ADMM_REGULARIZER_SOFT_THRESH} TaoADMMRegularizerType;
     83: PETSC_EXTERN const char *const TaoADMMRegularizerTypes[];
     84: /*MC
     85:      TAO_ADMM_REGULARIZER_USER - User provided routines for regularizer part of ADMM

     87:   Level: advanced

     89:   Note: User needs to provided appropriate routines and type for regularizer solver

     91: .seealso: TaoADMMSetRegularizerType(), TAO_ADMM_REGULARIZER_SOFT_THRESH
     92: M*/

     94: /*MC
     95:      TAO_ADMM_REGULARIZER_SOFT_THRESH - Soft threshold to solve regularizer part of ADMM

     97:   Level: advanced

     99:   Note: Utilizes built-in SoftThreshold routines

    101: .seealso: TaoSoftThreshold(), TaoADMMSetRegularizerObjectiveAndGradientRoutine(),
    102:           TaoADMMSetRegularizerHessianRoutine(), TaoADMMSetRegularizerType(), TAO_ADMM_REGULARIZER_USER
    103: M*/

    105: /*E
    106:      TaoALMMType - Determine the augmented Lagrangian formulation used in the TAOALMM subproblem.

    108: $  TAO_ALMM_CLASSIC - classic augmented Lagrangian definition including slack variables for inequality constraints
    109: $  TAO_ALMM_PHR     - Powell-Hestenes-Rockafellar formulation without slack variables, uses pointwise min() for inequalities

    111:   Level: advanced

    113: .seealso TAOALMM, TaoALMMSetType(), TaoALMMGetType()
    114: E*/
    115: typedef enum {TAO_ALMM_CLASSIC,TAO_ALMM_PHR} TaoALMMType;
    116: PETSC_EXTERN const char *const TaoALMMTypes[];

    118: typedef struct _p_Tao*   Tao;

    120: /*J
    121:         TaoType - String with the name of a TAO method

    123:        Level: beginner

    125: J*/
    126: typedef const char *TaoType;
    127: #define TAOLMVM     "lmvm"
    128: #define TAONLS      "nls"
    129: #define TAONTR      "ntr"
    130: #define TAONTL      "ntl"
    131: #define TAOCG       "cg"
    132: #define TAOTRON     "tron"
    133: #define TAOOWLQN    "owlqn"
    134: #define TAOBMRM     "bmrm"
    135: #define TAOBLMVM    "blmvm"
    136: #define TAOBQNLS    "bqnls"
    137: #define TAOBNCG     "bncg"
    138: #define TAOBNLS     "bnls"
    139: #define TAOBNTR     "bntr"
    140: #define TAOBNTL     "bntl"
    141: #define TAOBQNKLS   "bqnkls"
    142: #define TAOBQNKTR   "bqnktr"
    143: #define TAOBQNKTL   "bqnktl"
    144: #define TAOBQPIP    "bqpip"
    145: #define TAOGPCG     "gpcg"
    146: #define TAONM       "nm"
    147: #define TAOPOUNDERS "pounders"
    148: #define TAOBRGN     "brgn"
    149: #define TAOLCL      "lcl"
    150: #define TAOSSILS    "ssils"
    151: #define TAOSSFLS    "ssfls"
    152: #define TAOASILS    "asils"
    153: #define TAOASFLS    "asfls"
    154: #define TAOIPM      "ipm"
    155: #define TAOPDIPM    "pdipm"
    156: #define TAOSHELL    "shell"
    157: #define TAOADMM     "admm"
    158: #define TAOALMM     "almm"
    159: #define TAOPYTHON   "python"

    161: PETSC_EXTERN PetscClassId TAO_CLASSID;
    162: PETSC_EXTERN PetscFunctionList TaoList;

    164: /*E
    165:     TaoConvergedReason - reason a TAO method was said to have converged or diverged

    167:    Level: beginner

    169:    The two most common reasons for divergence are
    170: $   1) an incorrectly coded or computed gradient or Hessian
    171: $   2) failure or lack of convergence in the linear system (in this case we recommend
    172: $      testing with -pc_type lu to eliminate the linear solver as the cause of the problem).

    174:    Developer Notes:
    175:     this must match petsc/finclude/petsctao.h

    177:        The string versions of these are in TAOConvergedReasons, if you change any value here you must
    178:      also adjust that array.

    180: .seealso: TaoSolve(), TaoGetConvergedReason(), KSPConvergedReason, SNESConvergedReason, TSConvergedReason
    181: E*/
    182: typedef enum {/* converged */
    183:   TAO_CONVERGED_GATOL         =  3, /* ||g(X)|| < gatol */
    184:   TAO_CONVERGED_GRTOL         =  4, /* ||g(X)|| / f(X)  < grtol */
    185:   TAO_CONVERGED_GTTOL         =  5, /* ||g(X)|| / ||g(X0)|| < gttol */
    186:   TAO_CONVERGED_STEPTOL       =  6, /* step size small */
    187:   TAO_CONVERGED_MINF          =  7, /* F < F_min */
    188:   TAO_CONVERGED_USER          =  8, /* User defined */
    189:   /* diverged */
    190:   TAO_DIVERGED_MAXITS         = -2,
    191:   TAO_DIVERGED_NAN            = -4,
    192:   TAO_DIVERGED_MAXFCN         = -5,
    193:   TAO_DIVERGED_LS_FAILURE     = -6,
    194:   TAO_DIVERGED_TR_REDUCTION   = -7,
    195:   TAO_DIVERGED_USER           = -8, /* User defined */
    196:   /* keep going */
    197:   TAO_CONTINUE_ITERATING      =  0} TaoConvergedReason;

    199: PETSC_EXTERN const char **TaoConvergedReasons;

    201: PETSC_EXTERN PetscErrorCode TaoInitializePackage(void);
    202: PETSC_EXTERN PetscErrorCode TaoFinalizePackage(void);
    203: PETSC_EXTERN PetscErrorCode TaoCreate(MPI_Comm,Tao*);
    204: PETSC_EXTERN PetscErrorCode TaoSetFromOptions(Tao);
    205: PETSC_EXTERN PetscErrorCode TaoSetUp(Tao);
    206: PETSC_EXTERN PetscErrorCode TaoSetType(Tao,TaoType);
    207: PETSC_EXTERN PetscErrorCode TaoGetType(Tao,TaoType*);
    208: PETSC_EXTERN PetscErrorCode TaoSetApplicationContext(Tao,void*);
    209: PETSC_EXTERN PetscErrorCode TaoGetApplicationContext(Tao,void*);
    210: PETSC_EXTERN PetscErrorCode TaoDestroy(Tao*);

    212: PETSC_EXTERN PetscErrorCode TaoSetOptionsPrefix(Tao,const char[]);
    213: PETSC_EXTERN PetscErrorCode TaoView(Tao,PetscViewer);
    214: PETSC_EXTERN PetscErrorCode TaoViewFromOptions(Tao,PetscObject,const char[]);

    216: PETSC_EXTERN PetscErrorCode TaoSolve(Tao);

    218: PETSC_EXTERN PetscErrorCode TaoRegister(const char[],PetscErrorCode (*)(Tao));
    219: PETSC_EXTERN PetscErrorCode TaoRegisterDestroy(void);

    221: PETSC_EXTERN PetscErrorCode TaoGetConvergedReason(Tao,TaoConvergedReason*);
    222: PETSC_EXTERN PetscErrorCode TaoGetSolutionStatus(Tao,PetscInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,TaoConvergedReason*);
    223: PETSC_EXTERN PetscErrorCode TaoSetConvergedReason(Tao,TaoConvergedReason);
    224: PETSC_EXTERN PetscErrorCode TaoSetSolution(Tao,Vec);
    225: PETSC_EXTERN PetscErrorCode TaoGetSolution(Tao,Vec*);
    226: PETSC_DEPRECATED_FUNCTION("Use TaoSetSolution() (since version 3.17)") static inline PetscErrorCode TaoSetInitialVector(Tao t,Vec v) { return TaoSetSolution(t,v); }
    227: PETSC_DEPRECATED_FUNCTION("Use TaoGetSolution() (since version 3.17)") static inline PetscErrorCode TaoGetInitialVector(Tao t,Vec *v) { return TaoGetSolution(t,v); }

    229: PETSC_EXTERN PetscErrorCode TaoSetObjective(Tao,PetscErrorCode(*)(Tao,Vec,PetscReal*,void*),void*);
    230: PETSC_EXTERN PetscErrorCode TaoGetObjective(Tao,PetscErrorCode(**)(Tao,Vec,PetscReal*,void*),void**);
    231: PETSC_EXTERN PetscErrorCode TaoSetGradient(Tao,Vec,PetscErrorCode(*)(Tao,Vec,Vec,void*),void*);
    232: PETSC_EXTERN PetscErrorCode TaoGetGradient(Tao,Vec*,PetscErrorCode(**)(Tao,Vec,Vec,void*),void**);
    233: PETSC_EXTERN PetscErrorCode TaoSetObjectiveAndGradient(Tao,Vec,PetscErrorCode(*)(Tao,Vec,PetscReal*,Vec,void*),void*);
    234: PETSC_EXTERN PetscErrorCode TaoGetObjectiveAndGradient(Tao,Vec*,PetscErrorCode(**)(Tao,Vec,PetscReal*,Vec,void*),void**);
    235: PETSC_EXTERN PetscErrorCode TaoSetHessian(Tao,Mat,Mat,PetscErrorCode(*)(Tao,Vec,Mat,Mat,void*),void*);
    236: PETSC_EXTERN PetscErrorCode TaoGetHessian(Tao,Mat*,Mat*,PetscErrorCode(**)(Tao,Vec,Mat,Mat,void*),void**);
    237: PETSC_DEPRECATED_FUNCTION("Use TaoSetObjective() (since version 3.17)") static inline PetscErrorCode TaoSetObjectiveRoutine(Tao t,PetscErrorCode (*f)(Tao,Vec,PetscReal*,void*),void *c) { return TaoSetObjective(t,f,c); }
    238: PETSC_DEPRECATED_FUNCTION("Use TaoGetGradient() (since version 3.17)") static inline PetscErrorCode TaoGetGradientVector(Tao t,Vec *v) { return TaoGetGradient(t,v,NULL,NULL); }
    239: PETSC_DEPRECATED_FUNCTION("Use TaoSetGradient() (since version 3.17)") static inline PetscErrorCode TaoSetGradientRoutine(Tao t,PetscErrorCode (*f)(Tao,Vec,Vec,void*),void *c) { return TaoSetGradient(t,NULL,f,c); }
    240: PETSC_DEPRECATED_FUNCTION("Use TaoSetObjectiveAndGradient() (since version 3.17)") static inline PetscErrorCode TaoSetObjectiveAndGradientRoutine(Tao t,PetscErrorCode (*f)(Tao,Vec,PetscReal*,Vec,void*),void *c) { return TaoSetObjectiveAndGradient(t,NULL,f,c); }
    241: PETSC_DEPRECATED_FUNCTION("Use TaoSetHessian() (since version 3.17)") static inline PetscErrorCode TaoSetHessianRoutine(Tao t,Mat H,Mat P,PetscErrorCode (*f)(Tao,Vec,Mat,Mat,void*),void *c) { return TaoSetHessian(t,H,P,f,c); }

    243: PETSC_EXTERN PetscErrorCode TaoSetGradientNorm(Tao,Mat);
    244: PETSC_EXTERN PetscErrorCode TaoGetGradientNorm(Tao,Mat*);
    245: PETSC_EXTERN PetscErrorCode TaoSetLMVMMatrix(Tao,Mat);
    246: PETSC_EXTERN PetscErrorCode TaoGetLMVMMatrix(Tao,Mat*);
    247: PETSC_EXTERN PetscErrorCode TaoSetRecycleHistory(Tao,PetscBool);
    248: PETSC_EXTERN PetscErrorCode TaoGetRecycleHistory(Tao,PetscBool*);
    249: PETSC_EXTERN PetscErrorCode TaoLMVMSetH0(Tao,Mat);
    250: PETSC_EXTERN PetscErrorCode TaoLMVMGetH0(Tao,Mat*);
    251: PETSC_EXTERN PetscErrorCode TaoLMVMGetH0KSP(Tao,KSP*);
    252: PETSC_EXTERN PetscErrorCode TaoLMVMRecycle(Tao,PetscBool);
    253: PETSC_EXTERN PetscErrorCode TaoSetResidualRoutine(Tao,Vec,PetscErrorCode(*)(Tao,Vec,Vec,void*),void*);
    254: PETSC_EXTERN PetscErrorCode TaoSetResidualWeights(Tao,Vec,PetscInt,PetscInt*,PetscInt*,PetscReal*);
    255: PETSC_EXTERN PetscErrorCode TaoSetConstraintsRoutine(Tao,Vec,PetscErrorCode(*)(Tao,Vec,Vec,void*),void*);
    256: PETSC_EXTERN PetscErrorCode TaoSetInequalityConstraintsRoutine(Tao,Vec,PetscErrorCode(*)(Tao,Vec,Vec,void*),void*);
    257: PETSC_EXTERN PetscErrorCode TaoSetEqualityConstraintsRoutine(Tao,Vec,PetscErrorCode(*)(Tao,Vec,Vec,void*),void*);
    258: PETSC_EXTERN PetscErrorCode TaoSetJacobianResidualRoutine(Tao,Mat,Mat,PetscErrorCode(*)(Tao,Vec,Mat,Mat,void*),void*);
    259: PETSC_EXTERN PetscErrorCode TaoSetJacobianRoutine(Tao,Mat,Mat,PetscErrorCode(*)(Tao,Vec,Mat,Mat,void*),void*);
    260: PETSC_EXTERN PetscErrorCode TaoSetJacobianStateRoutine(Tao,Mat,Mat,Mat,PetscErrorCode(*)(Tao,Vec,Mat,Mat,Mat,void*),void*);
    261: PETSC_EXTERN PetscErrorCode TaoSetJacobianDesignRoutine(Tao,Mat,PetscErrorCode(*)(Tao,Vec,Mat,void*),void*);
    262: PETSC_EXTERN PetscErrorCode TaoSetJacobianInequalityRoutine(Tao,Mat,Mat,PetscErrorCode(*)(Tao,Vec,Mat,Mat,void*),void*);
    263: PETSC_EXTERN PetscErrorCode TaoSetJacobianEqualityRoutine(Tao,Mat,Mat,PetscErrorCode(*)(Tao,Vec,Mat,Mat,void*),void*);

    265: PETSC_EXTERN PetscErrorCode TaoPythonSetType(Tao,const char[]);

    267: PETSC_EXTERN PetscErrorCode TaoShellSetSolve(Tao,PetscErrorCode(*)(Tao));
    268: PETSC_EXTERN PetscErrorCode TaoShellSetContext(Tao,void*);
    269: PETSC_EXTERN PetscErrorCode TaoShellGetContext(Tao,void*);

    271: PETSC_DEPRECATED_FUNCTION("Use TaoSetResidualRoutine() (since version 3.11)") static inline PetscErrorCode TaoSetSeparableObjectiveRoutine(Tao tao,Vec res,PetscErrorCode (*func)(Tao,Vec,Vec,void*),void *ctx) {return TaoSetResidualRoutine(tao,res,func,ctx);}
    272: PETSC_DEPRECATED_FUNCTION("Use TaoSetResidualWeights() (since version 3.11)") static inline PetscErrorCode TaoSetSeparableObjectiveWeights(Tao tao,Vec sigma_v,PetscInt n,PetscInt *rows,PetscInt *cols,PetscReal *vals) {return TaoSetResidualWeights(tao,sigma_v,n,rows,cols,vals);}

    274: PETSC_EXTERN PetscErrorCode TaoSetStateDesignIS(Tao,IS,IS);

    276: PETSC_EXTERN PetscErrorCode TaoComputeObjective(Tao,Vec,PetscReal*);
    277: PETSC_EXTERN PetscErrorCode TaoComputeResidual(Tao,Vec,Vec);
    278: PETSC_EXTERN PetscErrorCode TaoTestGradient(Tao,Vec,Vec);
    279: PETSC_EXTERN PetscErrorCode TaoComputeGradient(Tao,Vec,Vec);
    280: PETSC_EXTERN PetscErrorCode TaoComputeObjectiveAndGradient(Tao,Vec,PetscReal*,Vec);
    281: PETSC_EXTERN PetscErrorCode TaoComputeConstraints(Tao,Vec,Vec);
    282: PETSC_EXTERN PetscErrorCode TaoComputeInequalityConstraints(Tao,Vec,Vec);
    283: PETSC_EXTERN PetscErrorCode TaoComputeEqualityConstraints(Tao,Vec,Vec);
    284: PETSC_EXTERN PetscErrorCode TaoDefaultComputeGradient(Tao,Vec,Vec,void*);
    285: PETSC_EXTERN PetscErrorCode TaoIsObjectiveDefined(Tao,PetscBool*);
    286: PETSC_EXTERN PetscErrorCode TaoIsGradientDefined(Tao,PetscBool*);
    287: PETSC_EXTERN PetscErrorCode TaoIsObjectiveAndGradientDefined(Tao,PetscBool*);

    289: PETSC_DEPRECATED_FUNCTION("Use TaoComputeResidual() (since version 3.11)") static inline PetscErrorCode TaoComputeSeparableObjective(Tao tao,Vec X,Vec F) {return TaoComputeResidual(tao,X,F);}

    291: PETSC_EXTERN PetscErrorCode TaoTestHessian(Tao);
    292: PETSC_EXTERN PetscErrorCode TaoComputeHessian(Tao,Vec,Mat,Mat);
    293: PETSC_EXTERN PetscErrorCode TaoComputeResidualJacobian(Tao,Vec,Mat,Mat);
    294: PETSC_EXTERN PetscErrorCode TaoComputeJacobian(Tao,Vec,Mat,Mat);
    295: PETSC_EXTERN PetscErrorCode TaoComputeJacobianState(Tao,Vec,Mat,Mat,Mat);
    296: PETSC_EXTERN PetscErrorCode TaoComputeJacobianEquality(Tao,Vec,Mat,Mat);
    297: PETSC_EXTERN PetscErrorCode TaoComputeJacobianInequality(Tao,Vec,Mat,Mat);
    298: PETSC_EXTERN PetscErrorCode TaoComputeJacobianDesign(Tao,Vec,Mat);

    300: PETSC_EXTERN PetscErrorCode TaoDefaultComputeHessian(Tao,Vec,Mat,Mat,void*);
    301: PETSC_EXTERN PetscErrorCode TaoDefaultComputeHessianColor(Tao,Vec,Mat,Mat,void*);
    302: PETSC_EXTERN PetscErrorCode TaoDefaultComputeHessianMFFD(Tao,Vec,Mat,Mat,void*);
    303: PETSC_EXTERN PetscErrorCode TaoComputeDualVariables(Tao,Vec,Vec);
    304: PETSC_EXTERN PetscErrorCode TaoSetVariableBounds(Tao,Vec,Vec);
    305: PETSC_EXTERN PetscErrorCode TaoGetVariableBounds(Tao,Vec*,Vec*);
    306: PETSC_EXTERN PetscErrorCode TaoGetDualVariables(Tao,Vec*,Vec*);
    307: PETSC_EXTERN PetscErrorCode TaoSetInequalityBounds(Tao,Vec,Vec);
    308: PETSC_EXTERN PetscErrorCode TaoGetInequalityBounds(Tao,Vec*,Vec*);
    309: PETSC_EXTERN PetscErrorCode TaoSetVariableBoundsRoutine(Tao,PetscErrorCode(*)(Tao,Vec,Vec,void*),void*);
    310: PETSC_EXTERN PetscErrorCode TaoComputeVariableBounds(Tao);

    312: PETSC_EXTERN PetscErrorCode TaoGetTolerances(Tao,PetscReal*,PetscReal*,PetscReal*);
    313: PETSC_EXTERN PetscErrorCode TaoSetTolerances(Tao,PetscReal,PetscReal,PetscReal);
    314: PETSC_EXTERN PetscErrorCode TaoGetConstraintTolerances(Tao,PetscReal*,PetscReal*);
    315: PETSC_EXTERN PetscErrorCode TaoSetConstraintTolerances(Tao,PetscReal,PetscReal);
    316: PETSC_EXTERN PetscErrorCode TaoSetFunctionLowerBound(Tao,PetscReal);
    317: PETSC_EXTERN PetscErrorCode TaoSetInitialTrustRegionRadius(Tao,PetscReal);
    318: PETSC_EXTERN PetscErrorCode TaoSetMaximumIterations(Tao,PetscInt);
    319: PETSC_EXTERN PetscErrorCode TaoSetMaximumFunctionEvaluations(Tao,PetscInt);
    320: PETSC_EXTERN PetscErrorCode TaoGetFunctionLowerBound(Tao,PetscReal*);
    321: PETSC_EXTERN PetscErrorCode TaoGetInitialTrustRegionRadius(Tao,PetscReal*);
    322: PETSC_EXTERN PetscErrorCode TaoGetCurrentTrustRegionRadius(Tao,PetscReal*);
    323: PETSC_EXTERN PetscErrorCode TaoGetMaximumIterations(Tao,PetscInt*);
    324: PETSC_EXTERN PetscErrorCode TaoGetCurrentFunctionEvaluations(Tao,PetscInt*);
    325: PETSC_EXTERN PetscErrorCode TaoGetMaximumFunctionEvaluations(Tao,PetscInt*);
    326: PETSC_EXTERN PetscErrorCode TaoGetIterationNumber(Tao,PetscInt*);
    327: PETSC_EXTERN PetscErrorCode TaoSetIterationNumber(Tao,PetscInt);
    328: PETSC_EXTERN PetscErrorCode TaoGetTotalIterationNumber(Tao,PetscInt*);
    329: PETSC_EXTERN PetscErrorCode TaoSetTotalIterationNumber(Tao,PetscInt);
    330: PETSC_EXTERN PetscErrorCode TaoGetResidualNorm(Tao,PetscReal*);

    332: PETSC_EXTERN PetscErrorCode TaoAppendOptionsPrefix(Tao,const char[]);
    333: PETSC_EXTERN PetscErrorCode TaoGetOptionsPrefix(Tao,const char*[]);
    334: PETSC_EXTERN PetscErrorCode TaoResetStatistics(Tao);
    335: PETSC_EXTERN PetscErrorCode TaoSetUpdate(Tao,PetscErrorCode(*)(Tao,PetscInt,void*),void*);

    337: PETSC_EXTERN PetscErrorCode TaoGetKSP(Tao,KSP*);
    338: PETSC_EXTERN PetscErrorCode TaoGetLinearSolveIterations(Tao,PetscInt*);

    340: #include <petsctaolinesearch.h>

    342: PETSC_EXTERN PetscErrorCode TaoGetLineSearch(Tao,TaoLineSearch*);

    344: PETSC_EXTERN PetscErrorCode TaoSetConvergenceHistory(Tao,PetscReal*,PetscReal*,PetscReal*,PetscInt*,PetscInt,PetscBool);
    345: PETSC_EXTERN PetscErrorCode TaoGetConvergenceHistory(Tao,PetscReal**,PetscReal**,PetscReal**,PetscInt**,PetscInt*);
    346: PETSC_EXTERN PetscErrorCode TaoSetMonitor(Tao,PetscErrorCode (*)(Tao,void*),void *,PetscErrorCode (*)(void**));
    347: PETSC_EXTERN PetscErrorCode TaoCancelMonitors(Tao);
    348: PETSC_EXTERN PetscErrorCode TaoMonitorDefault(Tao,void*);
    349: PETSC_DEPRECATED_FUNCTION("Use TaoMonitorDefault() (since version 3.9)") static inline PetscErrorCode TaoDefaultMonitor(Tao tao,void*ctx) {return TaoMonitorDefault(tao,ctx);}
    350: PETSC_EXTERN PetscErrorCode TaoDefaultGMonitor(Tao,void*);
    351: PETSC_EXTERN PetscErrorCode TaoDefaultSMonitor(Tao,void*);
    352: PETSC_EXTERN PetscErrorCode TaoDefaultCMonitor(Tao,void*);
    353: PETSC_EXTERN PetscErrorCode TaoSolutionMonitor(Tao,void*);
    354: PETSC_EXTERN PetscErrorCode TaoResidualMonitor(Tao,void*);
    355: PETSC_EXTERN PetscErrorCode TaoGradientMonitor(Tao,void*);
    356: PETSC_EXTERN PetscErrorCode TaoStepDirectionMonitor(Tao,void*);
    357: PETSC_EXTERN PetscErrorCode TaoDrawSolutionMonitor(Tao,void*);
    358: PETSC_EXTERN PetscErrorCode TaoDrawStepMonitor(Tao,void*);
    359: PETSC_EXTERN PetscErrorCode TaoDrawGradientMonitor(Tao,void*);
    360: PETSC_EXTERN PetscErrorCode TaoAddLineSearchCounts(Tao);

    362: PETSC_EXTERN PetscErrorCode TaoDefaultConvergenceTest(Tao,void*);
    363: PETSC_EXTERN PetscErrorCode TaoSetConvergenceTest(Tao,PetscErrorCode (*)(Tao,void*),void *);

    365: PETSC_EXTERN PetscErrorCode TaoLCLSetStateDesignIS(Tao,IS,IS);
    366: PETSC_EXTERN PetscErrorCode TaoMonitor(Tao,PetscInt,PetscReal,PetscReal,PetscReal,PetscReal);
    367: typedef struct _n_TaoMonitorDrawCtx* TaoMonitorDrawCtx;
    368: PETSC_EXTERN PetscErrorCode TaoMonitorDrawCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TaoMonitorDrawCtx*);
    369: PETSC_EXTERN PetscErrorCode TaoMonitorDrawCtxDestroy(TaoMonitorDrawCtx*);

    371: PETSC_EXTERN PetscErrorCode TaoBRGNGetSubsolver(Tao,Tao *);
    372: PETSC_EXTERN PetscErrorCode TaoBRGNSetRegularizerObjectiveAndGradientRoutine(Tao,PetscErrorCode (*)(Tao,Vec,PetscReal*,Vec,void*),void*);
    373: PETSC_EXTERN PetscErrorCode TaoBRGNSetRegularizerHessianRoutine(Tao,Mat,PetscErrorCode (*)(Tao,Vec,Mat,void*),void*);
    374: PETSC_EXTERN PetscErrorCode TaoBRGNSetRegularizerWeight(Tao,PetscReal);
    375: PETSC_EXTERN PetscErrorCode TaoBRGNSetL1SmoothEpsilon(Tao,PetscReal);
    376: PETSC_EXTERN PetscErrorCode TaoBRGNSetDictionaryMatrix(Tao,Mat);
    377: PETSC_EXTERN PetscErrorCode TaoBRGNGetDampingVector(Tao,Vec *);

    379: PETSC_EXTERN PetscErrorCode TaoADMMGetMisfitSubsolver(Tao,Tao *);
    380: PETSC_EXTERN PetscErrorCode TaoADMMGetRegularizationSubsolver(Tao,Tao *);
    381: PETSC_EXTERN PetscErrorCode TaoADMMGetDualVector(Tao,Vec*);
    382: PETSC_EXTERN PetscErrorCode TaoADMMGetSpectralPenalty(Tao,PetscReal*);
    383: PETSC_EXTERN PetscErrorCode TaoADMMSetSpectralPenalty(Tao,PetscReal);
    384: PETSC_EXTERN PetscErrorCode TaoGetADMMParentTao(Tao,Tao *);
    385: PETSC_EXTERN PetscErrorCode TaoADMMSetConstraintVectorRHS(Tao,Vec);
    386: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerCoefficient(Tao,PetscReal);
    387: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitConstraintJacobian(Tao,Mat,Mat,PetscErrorCode (*)(Tao,Vec,Mat,Mat,void*),void*);
    388: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerConstraintJacobian(Tao,Mat,Mat,PetscErrorCode (*)(Tao,Vec,Mat,Mat,void*),void*);
    389: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerHessianRoutine(Tao,Mat,Mat,PetscErrorCode (*)(Tao,Vec,Mat,Mat,void*),void*);
    390: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerObjectiveAndGradientRoutine(Tao,PetscErrorCode (*)(Tao,Vec,PetscReal *,Vec,void*),void*);
    391: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitHessianRoutine(Tao,Mat,Mat,PetscErrorCode (*)(Tao,Vec,Mat,Mat,void*),void*);
    392: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitObjectiveAndGradientRoutine(Tao,PetscErrorCode (*)(Tao,Vec,PetscReal *,Vec,void*),void*);
    393: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitHessianChangeStatus(Tao,PetscBool);
    394: PETSC_EXTERN PetscErrorCode TaoADMMSetRegHessianChangeStatus(Tao,PetscBool);
    395: PETSC_EXTERN PetscErrorCode TaoADMMSetMinimumSpectralPenalty(Tao,PetscReal);
    396: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerType(Tao,TaoADMMRegularizerType);
    397: PETSC_EXTERN PetscErrorCode TaoADMMGetRegularizerType(Tao,TaoADMMRegularizerType*);
    398: PETSC_EXTERN PetscErrorCode TaoADMMSetUpdateType(Tao,TaoADMMUpdateType);
    399: PETSC_EXTERN PetscErrorCode TaoADMMGetUpdateType(Tao,TaoADMMUpdateType*);

    401: PETSC_EXTERN PetscErrorCode TaoALMMGetType(Tao,TaoALMMType*);
    402: PETSC_EXTERN PetscErrorCode TaoALMMSetType(Tao,TaoALMMType);
    403: PETSC_EXTERN PetscErrorCode TaoALMMGetSubsolver(Tao,Tao*);
    404: PETSC_EXTERN PetscErrorCode TaoALMMSetSubsolver(Tao,Tao);
    405: PETSC_EXTERN PetscErrorCode TaoALMMGetMultipliers(Tao,Vec*);
    406: PETSC_EXTERN PetscErrorCode TaoALMMSetMultipliers(Tao,Vec);
    407: PETSC_EXTERN PetscErrorCode TaoALMMGetPrimalIS(Tao,IS*,IS*);
    408: PETSC_EXTERN PetscErrorCode TaoALMMGetDualIS(Tao,IS*,IS*);
    409: #endif