Tao (Optimization) - Low-level Interface
The Tao (Toolkit for Advanced Optimization) component provides methods for solving optimization problems, including unconstrained minimization, bound-constrained optimization, and constrained optimization.
Overview
Tao supports various optimization algorithms:
- Unconstrained: Conjugate gradient (CG), limited-memory BFGS (BLMVM), Nelder-Mead
- Bound-constrained: Bound-constrained BFGS (BNCG, BNLS, BNTL), active-set methods
- Constrained: Augmented Lagrangian methods (ALMM), interior point methods
- Least-squares: Gauss-Newton methods, Levenberg-Marquardt
- Complementarity: Semismooth methods for complementarity problems
- PDE-constrained: Methods suitable for PDE-constrained optimization
The Tao object manages the optimization process, line searches, convergence monitoring, and provides a unified interface across different optimization algorithms.
Basic Usage
using PETSc, MPI
# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)
# Create a Tao object
tao = LibPETSc.TaoCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
# Set the optimization algorithm (e.g., LMVM, BLMVM, NLS)
LibPETSc.TaoSetType(petsclib, tao, "lmvm")
# Set the objective function and gradient
# LibPETSc.TaoSetObjective(petsclib, tao, objective_function_ptr, C_NULL)
# LibPETSc.TaoSetGradient(petsclib, tao, C_NULL, gradient_function_ptr, C_NULL)
# For bound-constrained problems, set variable bounds
# LibPETSc.TaoSetVariableBounds(petsclib, tao, lower_bound_vec, upper_bound_vec)
# Set convergence tolerances
LibPETSc.TaoSetTolerances(petsclib, tao, 1e-8, 1e-8, 1e-8)
# Set maximum iterations
LibPETSc.TaoSetMaximumIterations(petsclib, tao, 1000)
# Set options from command line/options database
LibPETSc.TaoSetFromOptions(petsclib, tao)
# Set initial guess
# LibPETSc.TaoSetSolution(petsclib, tao, initial_vec)
# Solve the optimization problem
# LibPETSc.TaoSolve(petsclib, tao)
# Get solution information
reason = LibPETSc.TaoGetConvergedReason(petsclib, tao)
iter = LibPETSc.TaoGetIterationNumber(petsclib, tao)
println("Tao reason: $(reason), iterations: $(iter)")
# Cleanup
LibPETSc.TaoDestroy(petsclib, tao)
# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()Common Workflow
- Create and configure Tao: Use
TaoCreate,TaoSetType - Define objective:
TaoSetObjective,TaoSetGradient, optionallyTaoSetHessian - Set constraints (if any):
TaoSetVariableBounds,TaoSetConstraints - Configure solver:
TaoSetTolerances,TaoSetMaximumIterations - Set initial guess:
TaoSetSolution - Solve:
TaoSolve - Retrieve solution:
TaoGetSolution,TaoGetConvergedReason
Optimization Algorithms
Available through TaoSetType:
Unconstrained:
TAOLMVM: Limited-memory variable metric (quasi-Newton)TAOCG: Conjugate gradient methodsTAONM: Nelder-Mead simplex methodTAONLS: Newton line searchTAONTL: Newton trust-region with line search
Bound-constrained:
TAOBLMVM: Bound-constrained limited-memory variable metricTAOBNCG: Bound-constrained conjugate gradientTAOBQNLS: Bound-constrained quasi-Newton line searchTAOBNTL: Bound-constrained Newton trust-regionTAOTRON: Trust-region Newton method
The types built on an LMVM matrix (lmvm, blmvm, bncg, bqnls, bqnkls, bntl and bntr) fail after a PETSc.finalize/PETSc.initialize cycle in which a KSP was created: PETSc 3.25 forgets the LMVM matrix types at PetscFinalize and has no public way to register them again, so TaoSetType throws with "Unknown Mat type given: lmvmbfgs". Initialize once per Julia session, or restart Julia. cg, nm, nls, ntr, ntl and tron are not affected.
Constrained:
TAOALMM: Augmented Lagrangian multiplier methodTAOIPM: Interior point methodTAOPDIPM: Primal-dual interior point method
Least-squares:
TAOPOUNDERS: POUNDERs model-based methodTAOBRGN: Bounded regularized Gauss-Newton
Complementarity:
TAOSSLS: Semismooth least squaresTAOASLS: Active-set least squares
Convergence Criteria
Tao monitors several convergence criteria:
- Gradient tolerance:
||∇f|| < gatolor||∇f||/||f|| < grtol - Function tolerance:
|f - f_prev| < fatolor|f - f_prev|/|f| < frtol - Step tolerance:
||x - x_prev|| < steptol
Set using TaoSetTolerances(tao, gatol, grtol, gttol).
Hessian Options
For second-order methods:
- Exact Hessian: Provide via
TaoSetHessian - Finite-difference approximation: Use matrix-free approach
- Quasi-Newton approximation: LMVM methods build approximation automatically
Function Reference
PETSc.LibPETSc.TaoADMMGetDualVector — Method
Y::PetscVec = TaoADMMGetDualVector(petsclib::PetscLibType, tao::AbstractTao)Returns the dual vector associated with the current TAOADMM state
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
Y- the current solution
Level: intermediate
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetDualVector
PETSc.LibPETSc.TaoADMMGetMisfitSubsolver — Method
misfit::Tao = TaoADMMGetMisfitSubsolver(petsclib::PetscLibType, tao::AbstractTao)Get the pointer to the misfit subsolver inside TAOADMM
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
misfit- theTaosubsolver context
Level: advanced
See also: TAOADMM, Tao
External Links
- PETSc Manual:
Tao/TaoADMMGetMisfitSubsolver
PETSc.LibPETSc.TaoADMMGetRegularizationSubsolver — Method
reg::Tao = TaoADMMGetRegularizationSubsolver(petsclib::PetscLibType, tao::AbstractTao)Get the pointer to the regularization subsolver inside TAOADMM
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
reg- theTaosubsolver context
Level: advanced
See also: TAOADMM, Tao
External Links
- PETSc Manual:
Tao/TaoADMMGetRegularizationSubsolver
PETSc.LibPETSc.TaoADMMGetRegularizerCoefficient — Method
lambda::PetscReal = TaoADMMGetRegularizerCoefficient(petsclib::PetscLibType, tao::AbstractTao)Get the regularization coefficient lambda for L1 norm regularization case
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
lambda- L1-norm regularizer coefficient
Level: advanced
See also: TaoADMMSetMisfitConstraintJacobian(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetRegularizerCoefficient
PETSc.LibPETSc.TaoADMMGetRegularizerType — Method
type::TaoADMMRegularizerType = TaoADMMGetRegularizerType(petsclib::PetscLibType, tao::AbstractTao)Gets the type of regularizer routine for TAOADMM
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
type- the type of regularizer
Level: intermediate
See also: TaoADMMSetRegularizerType(), TaoADMMRegularizerType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetRegularizerType
PETSc.LibPETSc.TaoADMMGetSpectralPenalty — Method
mu::PetscReal = TaoADMMGetSpectralPenalty(petsclib::PetscLibType, tao::AbstractTao)Get the spectral penalty (mu) value
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
mu- spectral penalty
Level: advanced
See also: TaoADMMSetMinimumSpectralPenalty(), TaoADMMSetSpectralPenalty(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetSpectralPenalty
PETSc.LibPETSc.TaoADMMGetUpdateType — Method
type::TaoADMMUpdateType = TaoADMMGetUpdateType(petsclib::PetscLibType, tao::AbstractTao)Gets the type of spectral penalty update routine for TAOADMM
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
type- the type of spectral penalty update routine
Level: intermediate
See also: TaoADMMSetUpdateType(), TaoADMMUpdateType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetUpdateType
PETSc.LibPETSc.TaoADMMSetConstraintVectorRHS — Method
TaoADMMSetConstraintVectorRHS(petsclib::PetscLibType, tao::AbstractTao, c::AbstractPetscVec)Set the RHS constraint vector for TAOADMM
Collective
Input Parameters:
tao- theTaosolver contextc- RHS vector
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetConstraintVectorRHS
PETSc.LibPETSc.TaoADMMSetMinimumSpectralPenalty — Method
TaoADMMSetMinimumSpectralPenalty(petsclib::PetscLibType, tao::AbstractTao, mu::PetscReal)Set the minimum value for the spectral penalty
Collective
Input Parameters:
tao- theTaosolver contextmu- minimum spectral penalty value
Level: advanced
See also: TaoADMMGetSpectralPenalty(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMinimumSpectralPenalty
PETSc.LibPETSc.TaoADMMSetMisfitConstraintJacobian — Method
TaoADMMSetMisfitConstraintJacobian(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, Jpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Set the constraint matrix B for the TAOADMM algorithm. Matrix B constrains the z variable.
Collective
Input Parameters:
tao- the Tao solver contextJ- user-created misfit constraint Jacobian matrixJpre- user-created misfit Jacobian constraint matrix for constructing the preconditioner, often this isJfunc- function pointer for the misfit constraint Jacobian update functionctx- application context for the regularizer constraint Jacobian
Calling sequence of func:
tao- theTaocontextu- in current input solutionJ- the contribution to the misfit constraint JacobianJpre- the contribution to matrix from which to construct a preconditioner for the misfit constraint Jacobianctx- the optional application context
Level: advanced
See also: TaoADMMSetRegularizerCoefficient(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitConstraintJacobian
PETSc.LibPETSc.TaoADMMSetMisfitHessianChangeStatus — Method
TaoADMMSetMisfitHessianChangeStatus(petsclib::PetscLibType, tao::AbstractTao, b::PetscBool)Set boolean that determines whether Hessian matrix of misfit subsolver changes with respect to input vector.
Collective
Input Parameters:
tao- the Tao solver context.b- the Hessian matrix change status boolean,PETSC_FALSEwhen the Hessian matrix does not change,PETSC_TRUEotherwise.
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitHessianChangeStatus
PETSc.LibPETSc.TaoADMMSetMisfitHessianRoutine — Method
TaoADMMSetMisfitHessianRoutine(petsclib::PetscLibType, tao::AbstractTao, H::AbstractPetscMat, Hpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the user-defined misfit Hessian call-back function into the algorithm, to be used for subsolverX.
Collective
Input Parameters:
tao- theTaocontextH- user-created matrix for the Hessian of the misfit termHpre- user-created matrix for the preconditioner of Hessian of the misfit termfunc- function pointer for the misfit Hessian evaluationctx- application context for the misfit Hessian
Calling sequence of func:
tao- theTaocontextu- in current input solutionH- output, the contribution to the Hessian matrixHpre- an optional contribution to an alternative matrix with which the preconditioner is to be constructedctx- the optional application context
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitHessianRoutine
PETSc.LibPETSc.TaoADMMSetMisfitObjectiveAndGradientRoutine — Method
TaoADMMSetMisfitObjectiveAndGradientRoutine(petsclib::PetscLibType, tao::AbstractTao, func::external, ctx::Ptr{Cvoid})Sets the user-defined misfit call-back function
Collective
Input Parameters:
tao- theTaocontextfunc- function pointer for the misfit value and gradient evaluationctx- application context for the misfit
Calling sequence of func:
tao- theTaocontextu- in current input solutionf- the contribution to the objective functiong- the contribution to the gradientctx- the optional application context
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitObjectiveAndGradientRoutine
PETSc.LibPETSc.TaoADMMSetRegHessianChangeStatus — Method
TaoADMMSetRegHessianChangeStatus(petsclib::PetscLibType, tao::AbstractTao, b::PetscBool)Set boolean that determines whether Hessian matrix of regularization subsolver changes with respect to input vector.
Collective
Input Parameters:
tao- theTaosolver contextb- the Hessian matrix change status boolean,PETSC_FALSEwhen the Hessian matrix does not change,PETSC_TRUEotherwise.
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegHessianChangeStatus
PETSc.LibPETSc.TaoADMMSetRegularizerCoefficient — Method
TaoADMMSetRegularizerCoefficient(petsclib::PetscLibType, tao::AbstractTao, lambda::PetscReal)Set the regularization coefficient lambda for L1 norm regularization case
Collective
Input Parameters:
tao- theTaosolver contextlambda- L1-norm regularizer coefficient
Level: advanced
See also: TaoADMMSetMisfitConstraintJacobian(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerCoefficient
PETSc.LibPETSc.TaoADMMSetRegularizerConstraintJacobian — Method
TaoADMMSetRegularizerConstraintJacobian(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, Jpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Set the constraint matrix B for TAOADMM algorithm. Matrix B constraints z variable.
Collective
Input Parameters:
tao- theTaosolver contextJ- user-created regularizer constraint Jacobian matrixJpre- user-created regularizer Jacobian constraint matrix for constructing the preconditioner, often this isJfunc- function pointer for the regularizer constraint Jacobian update functionctx- application context for the regularizer constraint Jacobian
Calling sequence of func:
tao- theTaocontextu- in current input solutionJ- the contribution to the constraint JacobianJpre- the contribution to matrix from which to construct a preconditioner for the constraint Jacobianctx- the optional application context
Level: advanced
See also: TaoADMMSetRegularizerCoefficient(), TaoADMMSetMisfitConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerConstraintJacobian
PETSc.LibPETSc.TaoADMMSetRegularizerHessianRoutine — Method
TaoADMMSetRegularizerHessianRoutine(petsclib::PetscLibType, tao::AbstractTao, H::AbstractPetscMat, Hpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the user-defined regularizer Hessian call-back function, to be used for subsolverZ.
Collective
Input Parameters:
tao- theTaocontextH- user-created matrix for the Hessian of the regularization termHpre- user-created matrix for building the preconditioner of the Hessian of the regularization termfunc- function pointer for the regularizer Hessian evaluationctx- application context for the regularizer Hessian
Calling sequence of func:
tao- theTaocontextu- in current input solutionH- output, the contribution to the Hessian matrixHpre- an optional contribution to an alternative matrix with which the preconditioner is to be constructedctx- the optional application context
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerHessianRoutine
PETSc.LibPETSc.TaoADMMSetRegularizerObjectiveAndGradientRoutine — Method
TaoADMMSetRegularizerObjectiveAndGradientRoutine(petsclib::PetscLibType, tao::AbstractTao, func::external, ctx::Ptr{Cvoid})Sets the user-defined regularizer call-back function
Collective
Input Parameters:
tao- the Tao contextfunc- function pointer for the regularizer value and gradient evaluationctx- application context for the regularizer
Calling sequence of func:
tao- theTaocontextu- in current input solutionf- the contribution to the objective functiong- the contribution to the gradientctx- the optional application context
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerObjectiveAndGradientRoutine
PETSc.LibPETSc.TaoADMMSetRegularizerType — Method
TaoADMMSetRegularizerType(petsclib::PetscLibType, tao::AbstractTao, type::TaoADMMRegularizerType)Set regularizer type for TAOADMM routine
Not Collective
Input Parameters:
tao- theTaocontexttype- regularizer type
Options Database Key:
-tao_admm_regularizer_type (regularizer_user|regularizer_soft_thresh)- select the regularizer
Level: intermediate
See also: TaoADMMGetRegularizerType(), TaoADMMRegularizerType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerType
PETSc.LibPETSc.TaoADMMSetSpectralPenalty — Method
TaoADMMSetSpectralPenalty(petsclib::PetscLibType, tao::AbstractTao, mu::PetscReal)Set the spectral penalty (mu) value
Collective
Input Parameters:
tao- theTaosolver contextmu- spectral penalty
Level: advanced
See also: TaoADMMSetMinimumSpectralPenalty(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetSpectralPenalty
PETSc.LibPETSc.TaoADMMSetUpdateType — Method
TaoADMMSetUpdateType(petsclib::PetscLibType, tao::AbstractTao, type::TaoADMMUpdateType)Set update routine for TAOADMM routine
Not Collective
Input Parameters:
tao- theTaocontexttype- spectral parameter update type
Level: intermediate
See also: TaoADMMGetUpdateType(), TaoADMMUpdateType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetUpdateType
PETSc.LibPETSc.TaoALMMGetDualIS — Method
eq_is::IS,ineq_is::IS = TaoALMMGetDualIS(petsclib::PetscLibType, tao::AbstractTao)Retrieve the index set that identifies equality and inequality constraint components of the dual vector returned by TaoALMMGetMultipliers().
Input Parameter:
tao- the Tao context for theTAOALMMsolver
Output Parameters:
eq_is- index set associated with the equality constraints (NULLif not needed)ineq_is- index set associated with the inequality constraints (NULLif not needed)
Level: advanced
See also: TAOALMM, Tao, TaoALMMGetMultipliers()
External Links
- PETSc Manual:
Tao/TaoALMMGetDualIS
PETSc.LibPETSc.TaoALMMGetMultipliers — Method
Y::PetscVec = TaoALMMGetMultipliers(petsclib::PetscLibType, tao::AbstractTao)Retrieve a pointer to the Lagrange multipliers.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameter:
Y- vector of Lagrange multipliers
Level: advanced
See also: TAOALMM, Tao, TaoALMMSetMultipliers(), TaoALMMGetDualIS()
External Links
- PETSc Manual:
Tao/TaoALMMGetMultipliers
PETSc.LibPETSc.TaoALMMGetPrimalIS — Method
opt_is::IS,slack_is::IS = TaoALMMGetPrimalIS(petsclib::PetscLibType, tao::AbstractTao)Retrieve the index set that identifies optimization and slack variable components of the subsolver's solution vector.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameters:
opt_is- index set associated with the optimization variables (NULLif not needed)slack_is- index set associated with the slack variables (NULLif not needed)
Level: advanced
See also: TAOALMM, Tao, IS, TaoALMMGetPrimalVector()
External Links
- PETSc Manual:
Tao/TaoALMMGetPrimalIS
PETSc.LibPETSc.TaoALMMGetSubsolver — Method
subsolver::Tao = TaoALMMGetSubsolver(petsclib::PetscLibType, tao::AbstractTao)Retrieve the subsolver being used by TAOALMM.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameter:
subsolver- theTaocontext for the subsolver
Level: advanced
See also: Tao, TAOALMM, TaoALMMSetSubsolver()
External Links
- PETSc Manual:
Tao/TaoALMMGetSubsolver
PETSc.LibPETSc.TaoALMMGetType — Method
type::TaoALMMType = TaoALMMGetType(petsclib::PetscLibType, tao::AbstractTao)Retrieve the augmented Lagrangian formulation type for the subproblem.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameter:
type- augmented Lagragrangian type
Level: advanced
See also: Tao, TAOALMM, TaoALMMSetType(), TaoALMMType
External Links
- PETSc Manual:
Tao/TaoALMMGetType
PETSc.LibPETSc.TaoALMMSetMultipliers — Method
TaoALMMSetMultipliers(petsclib::PetscLibType, tao::AbstractTao, Y::AbstractPetscVec)Set user-defined Lagrange multipliers.
Input Parameters:
tao- theTaocontext for theTAOALMMsolverY- vector of Lagrange multipliers
Level: advanced
See also: TAOALMM, Tao, TaoALMMGetMultipliers()
External Links
- PETSc Manual:
Tao/TaoALMMSetMultipliers
PETSc.LibPETSc.TaoALMMSetSubsolver — Method
TaoALMMSetSubsolver(petsclib::PetscLibType, tao::AbstractTao, subsolver::AbstractTao)Changes the subsolver inside TAOALMM with the user provided one.
Input Parameters:
tao- theTaocontext for theTAOALMMsolversubsolver- the Tao context for the subsolver
Level: advanced
See also: Tao, TAOALMM, TaoALMMGetSubsolver()
External Links
- PETSc Manual:
Tao/TaoALMMSetSubsolver
PETSc.LibPETSc.TaoALMMSetType — Method
TaoALMMSetType(petsclib::PetscLibType, tao::AbstractTao, type::TaoALMMType)Determine the augmented Lagrangian formulation type for the subproblem.
Input Parameters:
tao- theTaocontext for theTAOALMMsolvertype- augmented Lagragrangian type
Level: advanced
See also: Tao, TAOALMM, TaoALMMGetType(), TaoALMMType
External Links
- PETSc Manual:
Tao/TaoALMMSetType
PETSc.LibPETSc.TaoAddLineSearchCounts — Method
TaoAddLineSearchCounts(petsclib::PetscLibType, tao::AbstractTao)Adds the number of function evaluations spent in the line search to the running total.
Input Parameters:
tao- theTaosolver
Level: developer
See also: Tao, TaoGetLineSearch(), TaoLineSearchApply()
External Links
- PETSc Manual:
Tao/TaoAddLineSearchCounts
PETSc.LibPETSc.TaoAddTerm — Method
TaoAddTerm(petsclib::PetscLibType, tao::AbstractTao, prefix::String, scale::PetscReal, term::TaoTerm, params::AbstractPetscVec, map::AbstractPetscMat)Add a term to the objective function. If Tao is empty, term will be the objective of Tao.
Collective
Input Parameters:
tao- aTaosolver contextprefix- the prefix used for configuring the new term (ifNULL, the index of the term will be used as a prefix, e.g. "0", "1", etc.)scale- scaling coefficient for the new termterm- the real-valued function defining the new termparams- (optional) parameters for the new term. It is up to each implementation ofTaoTermto determine how it behaves when parameters are omitted.map- (optional) a map from thetaosolution space to thetermsolution space; ifNULLthe map is assumed to be the identity
Level: beginner
See also: Tao, TaoTerm, TAOTERMSUM, TaoGetTerm()
External Links
- PETSc Manual:
Tao/TaoAddTerm
PETSc.LibPETSc.TaoAppendOptionsPrefix — Method
TaoAppendOptionsPrefix(petsclib::PetscLibType, tao::AbstractTao, p::String)Appends to the prefix used for searching for all Tao options in the database.
Logically Collective
Input Parameters:
tao- theTaosolver contextp- the prefix string to prepend to allTaooption requests
Level: advanced
See also: Tao, TaoSetFromOptions(), TaoSetOptionsPrefix(), TaoGetOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoAppendOptionsPrefix
PETSc.LibPETSc.TaoBNCGGetType — Method
type::TaoBNCGType = TaoBNCGGetType(petsclib::PetscLibType, tao::AbstractTao)Return the type for the TAOBNCG solver
Input Parameter:
tao- theTaosolver context
Output Parameter:
type-TAOBNCGtype
Level: advanced
See also: Tao, TAOBNCG, TaoBNCGSetType(), TaoBNCGType
External Links
- PETSc Manual:
Tao/TaoBNCGGetType
PETSc.LibPETSc.TaoBNCGSetType — Method
TaoBNCGSetType(petsclib::PetscLibType, tao::AbstractTao, type::TaoBNCGType)Set the type for the TAOBNCG solver
Input Parameters:
tao- theTaosolver contexttype-TAOBNCGtype
Level: advanced
See also: Tao, TAOBNCG, TaoBNCGGetType(), TaoBNCGType
External Links
- PETSc Manual:
Tao/TaoBNCGSetType
PETSc.LibPETSc.TaoBRGNGetDampingVector — Method
d::PetscVec = TaoBRGNGetDampingVector(petsclib::PetscLibType, tao::AbstractTao)Get the damping vector \mathrm{diag}(J^T J) from a TAOBRGN with TAOBRGN_REGULARIZATION_LM regularization
Collective
Input Parameter:
tao- aTaoof typeTAOBRGNwithTAOBRGN_REGULARIZATION_LMregularization
Output Parameter:
d- the damping vector
Level: developer
See also: Tao, TAOBRGN, TaoBRGNRegularzationTypes
External Links
- PETSc Manual:
Tao/TaoBRGNGetDampingVector
PETSc.LibPETSc.TaoBRGNGetRegularizationType — Method
type::TaoBRGNRegularizationType = TaoBRGNGetRegularizationType(petsclib::PetscLibType, tao::AbstractTao)Get the TaoBRGNRegularizationType of a TAOBRGN
Not collective
Input Parameter:
tao- aTaoof typeTAOBRGN
Output Parameter:
type- theTaoBRGNRegularizationType
Level: advanced
See also: Tao, TAOBRGN, TaoBRGNRegularizationType, TaoBRGNSetRegularizationType()
External Links
- PETSc Manual:
Tao/TaoBRGNGetRegularizationType
PETSc.LibPETSc.TaoBRGNGetSubsolver — Method
TaoBRGNGetSubsolver(petsclib::PetscLibType, tao::AbstractTao, subsolver::AbstractTao)Get the pointer to the subsolver inside a TAOBRGN
Collective
Input Parameters:
tao- the Tao solver contextsubsolver- theTaosub-solver context
Level: advanced
See also: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNGetSubsolver
PETSc.LibPETSc.TaoBRGNSetDictionaryMatrix — Method
TaoBRGNSetDictionaryMatrix(petsclib::PetscLibType, tao::AbstractTao, dict::AbstractPetscMat)bind the dictionary matrix from user application context to gn->D, for compressed sensing (with least-squares problem)
Input Parameters:
tao- theTaocontextdict- the user specified dictionary matrix. We allow to set aNULLdictionary, which means identity matrix by default
Level: advanced
See also: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetDictionaryMatrix
PETSc.LibPETSc.TaoBRGNSetL1SmoothEpsilon — Method
TaoBRGNSetL1SmoothEpsilon(petsclib::PetscLibType, tao::AbstractTao, epsilon::PetscReal)Set the L1-norm smooth approximation parameter for L1-regularized least-squares algorithm
Collective
Input Parameters:
tao- theTaosolver contextepsilon- L1-norm smooth approximation parameter
Level: advanced
See also: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetL1SmoothEpsilon
PETSc.LibPETSc.TaoBRGNSetRegularizationType — Method
TaoBRGNSetRegularizationType(petsclib::PetscLibType, tao::AbstractTao, type::TaoBRGNRegularizationType)Set the TaoBRGNRegularizationType of a TAOBRGN
Logically collective
Input Parameters:
tao- aTaoof typeTAOBRGNtype- theTaoBRGNRegularizationType
Level: advanced
See also: Tao, TAOBRGN, TaoBRGNRegularizationType, TaoBRGNGetRegularizationType
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizationType
PETSc.LibPETSc.TaoBRGNSetRegularizerHessianRoutine — Method
TaoBRGNSetRegularizerHessianRoutine(petsclib::PetscLibType, tao::AbstractTao, Hreg::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the user-defined regularizer call-back function into the algorithm.
Input Parameters:
tao- theTaocontextHreg- user-created matrix for the Hessian of the regularization termfunc- function pointer for the regularizer Hessian evaluationctx- application context for the regularizer Hessian
Calling sequence:
tao- theTaocontextu- the location at which to compute the HessianHreg- user-created matrix for the Hessian of the regularization termctx- application context for the regularizer Hessian
Level: advanced
See also: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizerHessianRoutine
PETSc.LibPETSc.TaoBRGNSetRegularizerObjectiveAndGradientRoutine — Method
TaoBRGNSetRegularizerObjectiveAndGradientRoutine(petsclib::PetscLibType, tao::AbstractTao, func::external, ctx::Ptr{Cvoid})Sets the user-defined regularizer call-back function into the algorithm.
Input Parameters:
tao- the Tao contextfunc- function pointer for the regularizer value and gradient evaluationctx- application context for the regularizer
Calling sequence:
tao- theTaocontextu- the location at which to compute the objective and gradientval- location to store objective function valueg- location to store gradientctx- application context for the regularizer Hessian
Level: advanced
See also: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizerObjectiveAndGradientRoutine
PETSc.LibPETSc.TaoBRGNSetRegularizerWeight — Method
TaoBRGNSetRegularizerWeight(petsclib::PetscLibType, tao::AbstractTao, lambda::PetscReal)Set the regularizer weight for the Gauss-Newton least-squares algorithm
Collective
Input Parameters:
tao- theTaosolver contextlambda- L1-norm regularizer weight
Level: beginner
See also: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizerWeight
PETSc.LibPETSc.TaoBoundSolution — Method
nDiff::PetscInt = TaoBoundSolution(petsclib::PetscLibType, X::AbstractPetscVec, XL::AbstractPetscVec, XU::AbstractPetscVec, bound_tol::PetscReal, Xout::AbstractPetscVec)Ensures that the solution vector is snapped into the bounds within a given tolerance.
Collective
Input Parameters:
X- solution vectorXL- lower bound vectorXU- upper bound vectorbound_tol- absolute tolerance in enforcing the bound
Output Parameters:
nDiff- total number of vector entries that have been boundedXout- modified solution vector satisfying bounds tobound_tol
Level: developer
See also: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundStep()
External Links
- PETSc Manual:
Tao/TaoBoundSolution
PETSc.LibPETSc.TaoBoundStep — Method
TaoBoundStep(petsclib::PetscLibType, X::AbstractPetscVec, XL::AbstractPetscVec, XU::AbstractPetscVec, active_lower::AbstractIS, active_upper::AbstractIS, active_fixed::AbstractIS, scale::PetscReal, S::AbstractPetscVec)Ensures the correct zero or adjusted step direction values for active variables.
Input Parameters:
X- solution vectorXL- lower bound vectorXU- upper bound vectoractive_lower- index set for lower bounded active variablesactive_upper- index set for lower bounded active variablesactive_fixed- index set for fixed active variablesscale- amplification factor for the step that needs to be taken on actively bounded variables
Output Parameter:
S- step direction to be modified
Level: developer
See also: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundSolution()
External Links
- PETSc Manual:
Tao/TaoBoundStep
PETSc.LibPETSc.TaoComputeConstraints — Method
TaoComputeConstraints(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, C::AbstractPetscVec)Compute the variable bounds using the routine set by TaoSetConstraintsRoutine().
Collective
Input Parameters:
tao- theTaocontextX- location to evaluate the constraints
Output Parameter:
C- the constraints
Level: developer
See also: Tao, TaoSetConstraintsRoutine(), TaoComputeJacobian()
External Links
- PETSc Manual:
Tao/TaoComputeConstraints
PETSc.LibPETSc.TaoComputeDualVariables — Method
TaoComputeDualVariables(petsclib::PetscLibType, tao::AbstractTao, DL::AbstractPetscVec, DU::AbstractPetscVec)Computes the dual vectors corresponding to the bounds of the variables
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
DL- dual variable vector for the lower boundsDU- dual variable vector for the upper bounds
Level: advanced
See also: Tao, TaoComputeObjective(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoComputeDualVariables
PETSc.LibPETSc.TaoComputeEqualityConstraints — Method
TaoComputeEqualityConstraints(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, CE::AbstractPetscVec)Compute the variable bounds using the routine set by TaoSetEqualityConstraintsRoutine().
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
X- point the equality constraints were evaluated onCE- vector of equality constraints evaluated at X
Level: developer
See also: Tao, TaoSetEqualityConstraintsRoutine(), TaoComputeJacobianEquality(), TaoComputeInequalityConstraints()
External Links
- PETSc Manual:
Tao/TaoComputeEqualityConstraints
PETSc.LibPETSc.TaoComputeGradient — Method
TaoComputeGradient(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, G::AbstractPetscVec)Computes the gradient of the objective function
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameter:
G- gradient vector
Options Database Keys:
-tao_test_gradient- compare the user provided gradient with one compute via finite differences to check for errors-tao_test_gradient_view- display the user provided gradient, the finite difference gradient and the difference between them to help users detect the location of errors in the user provided gradient
Level: developer
See also: TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetGradient()
External Links
- PETSc Manual:
Tao/TaoComputeGradient
PETSc.LibPETSc.TaoComputeHessian — Method
TaoComputeHessian(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, H::AbstractPetscMat, Hpre::AbstractPetscMat)Computes the Hessian matrix that has been set with TaoSetHessian().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameters:
H- Hessian matrixHpre- matrix used to construct the preconditioner, usually the same asH
Options Database Keys:
-tao_test_hessian- compare the user provided Hessian with one compute via finite differences to check for errors-tao_test_hessian numerical value- display entries in the difference between the user provided Hessian and finite difference Hessian that are greater than a certain value to help users detect errors-tao_test_hessian_view- display the user provided Hessian, the finite difference Hessian and the difference between them to help users detect the location of errors in the user provided Hessian
Level: developer
See also: Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetHessian()
External Links
- PETSc Manual:
Tao/TaoComputeHessian
PETSc.LibPETSc.TaoComputeInequalityConstraints — Method
TaoComputeInequalityConstraints(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, CI::AbstractPetscVec)Compute the variable bounds using the routine set by TaoSetInequalityConstraintsRoutine().
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
X- point the inequality constraints were evaluated onCI- vector of inequality constraints evaluated at X
Level: developer
See also: Tao, TaoSetInequalityConstraintsRoutine(), TaoComputeJacobianInequality(), TaoComputeEqualityConstraints()
External Links
- PETSc Manual:
Tao/TaoComputeInequalityConstraints
PETSc.LibPETSc.TaoComputeJacobian — Method
TaoComputeJacobian(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, J::AbstractPetscMat, Jpre::AbstractPetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianRoutine().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to compute the preconditioner, often the same asJ
Level: developer
See also: TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianRoutine()
External Links
- PETSc Manual:
Tao/TaoComputeJacobian
PETSc.LibPETSc.TaoComputeJacobianDesign — Method
TaoComputeJacobianDesign(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, J::AbstractPetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianDesignRoutine().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameter:
J- Jacobian matrix
Level: developer
See also: Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianDesignRoutine(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianDesign
PETSc.LibPETSc.TaoComputeJacobianEquality — Method
TaoComputeJacobianEquality(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, J::AbstractPetscMat, Jpre::AbstractPetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianEqualityRoutine().
Collective
Input Parameters:
tao- theTaosolver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to construct the preconditioner, often the same asJ
Level: developer
See also: TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianEquality
PETSc.LibPETSc.TaoComputeJacobianInequality — Method
TaoComputeJacobianInequality(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, J::AbstractPetscMat, Jpre::AbstractPetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianInequalityRoutine().
Collective
Input Parameters:
tao- theTaosolver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to construct the preconditioner
Level: developer
See also: Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianInequality
PETSc.LibPETSc.TaoComputeJacobianState — Method
TaoComputeJacobianState(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, J::AbstractPetscMat, Jpre::AbstractPetscMat, Jinv::AbstractPetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianStateRoutine().
Collective
Input Parameters:
tao- theTaosolver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to construct the preconditioner, often the same asJJinv- unknown
Level: developer
See also: Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianState
PETSc.LibPETSc.TaoComputeObjective — Method
f::PetscReal = TaoComputeObjective(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameter:
f- Objective value at X
Level: developer
See also: Tao, TaoComputeGradient(), TaoComputeObjectiveAndGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoComputeObjective
PETSc.LibPETSc.TaoComputeObjectiveAndGradient — Method
f::PetscReal = TaoComputeObjectiveAndGradient(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, G::AbstractPetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameters:
f- Objective value atXG- Gradient vector atX
Level: developer
See also: TaoComputeGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoComputeObjectiveAndGradient
PETSc.LibPETSc.TaoComputeResidual — Method
TaoComputeResidual(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, F::AbstractPetscVec)Computes a least-squares residual vector at a given point
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameter:
F- Objective vector atX
Level: advanced
See also: Tao, TaoSetResidualRoutine()
External Links
- PETSc Manual:
Tao/TaoComputeResidual
PETSc.LibPETSc.TaoComputeResidualJacobian — Method
TaoComputeResidualJacobian(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, J::AbstractPetscMat, Jpre::AbstractPetscMat)Computes the least-squares residual Jacobian matrix that has been set with TaoSetJacobianResidual().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to compute the preconditioner, often the same asJ
Level: developer
See also: Tao, TaoComputeResidual(), TaoSetJacobianResidual()
External Links
- PETSc Manual:
Tao/TaoComputeResidualJacobian
PETSc.LibPETSc.TaoComputeVariableBounds — Method
TaoComputeVariableBounds(petsclib::PetscLibType, tao::AbstractTao)Compute the variable bounds using the routine set by TaoSetVariableBoundsRoutine().
Collective
Input Parameter:
tao- theTaocontext
Level: developer
See also: Tao, TaoSetVariableBoundsRoutine(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoComputeVariableBounds
PETSc.LibPETSc.TaoCreate — Method
newtao::Tao = TaoCreate(petsclib::PetscLibType, comm::MPI_Comm)Creates a Tao solver
Collective
Input Parameter:
comm- MPI communicator
Output Parameter:
newtao- the newTaocontext
Options Database Key:
-tao_type- select which method Tao should use
Level: beginner
See also: Tao, TaoSolve(), TaoDestroy(), TaoSetFromOptions(), TaoSetType()
External Links
- PETSc Manual:
Tao/TaoCreate
PETSc.LibPETSc.TaoDefaultComputeGradient — Method
TaoDefaultComputeGradient(petsclib::PetscLibType, tao::AbstractTao, Xin::AbstractPetscVec, G::AbstractPetscVec, dummy::Ptr{Cvoid})computes the gradient using finite differences.
Collective
Input Parameters:
tao- the Tao contextXin- compute gradient at this pointdummy- not used
Output Parameter:
G- Gradient Vector
Options Database Key:
-tao_fd_gradient- activates TaoDefaultComputeGradient()-tao_fd_delta delta- change in X used to calculate finite differences
Level: advanced
See also: Tao, TaoSetGradient(), TaoTermComputeGradientFD()
External Links
- PETSc Manual:
Tao/TaoDefaultComputeGradient
PETSc.LibPETSc.TaoDefaultComputeHessian — Method
TaoDefaultComputeHessian(petsclib::PetscLibType, tao::AbstractTao, V::AbstractPetscVec, H::AbstractPetscMat, B::AbstractPetscMat, dummy::Ptr{Cvoid})Computes the Hessian using finite differences.
Collective
Input Parameters:
tao- the Tao contextV- compute Hessian at this pointdummy- not used
Output Parameters:
H- Hessian matrix (not altered in this routine)B- newly computed Hessian matrix to use with preconditioner (generally the same as H)
Options Database Key:
-tao_fd_hessian- activates TaoDefaultComputeHessian()
Level: advanced
See also: Tao, TaoSetHessian(), TaoDefaultComputeHessianColor(), SNESComputeJacobianDefault(), TaoSetGradient(), TaoDefaultComputeGradient()
External Links
- PETSc Manual:
Tao/TaoDefaultComputeHessian
PETSc.LibPETSc.TaoDefaultComputeHessianColor — Method
TaoDefaultComputeHessianColor(petsclib::PetscLibType, tao::AbstractTao, V::AbstractPetscVec, H::AbstractPetscMat, B::AbstractPetscMat, ctx::Ptr{Cvoid})Computes the Hessian using colored finite differences.
Collective
Input Parameters:
tao- the Tao contextV- compute Hessian at this pointctx- the color object of typeMatFDColoring
Output Parameters:
H- Hessian matrix (not altered in this routine)B- newly computed Hessian matrix to use with preconditioner (generally the same as H)
Level: advanced
See also: Tao, MatColoring, TaoSetHessian(), TaoDefaultComputeHessian(), SNESComputeJacobianDefaultColor(), TaoSetGradient()
External Links
- PETSc Manual:
Tao/TaoDefaultComputeHessianColor
PETSc.LibPETSc.TaoDefaultComputeHessianMFFD — Method
TaoDefaultComputeHessianMFFD(petsclib::PetscLibType, tao::AbstractTao, X::AbstractPetscVec, H::AbstractPetscMat, B::AbstractPetscMat, ctx::Ptr{Cvoid})Computes the Hessian using finite differences with MATMFFD.
Collective
Input Parameters:
tao- theTaocontextX- compute Hessian at this pointctx- ignored
Output Parameters:
H- Hessian matrix of typeMATMFFDB- should beNULLor equal toH
Level: advanced
See also: Tao, MATMFFD, MatCreateMFFD(), TaoTermCreateHessianMFFD()
External Links
- PETSc Manual:
Tao/TaoDefaultComputeHessianMFFD
PETSc.LibPETSc.TaoDefaultConvergenceTest — Method
TaoDefaultConvergenceTest(petsclib::PetscLibType, tao::AbstractTao, dummy::Ptr{Cvoid})Determines whether the solver should continue iterating or terminate.
Collective
Input Parameters:
tao- theTaocontextdummy- unused dummy context
Level: developer
See also: Tao, TaoSetTolerances(), TaoGetConvergedReason(), TaoSetConvergedReason()
External Links
- PETSc Manual:
Tao/TaoDefaultConvergenceTest
PETSc.LibPETSc.TaoDestroy — Method
TaoDestroy(petsclib::PetscLibType, tao::AbstractTao)Destroys the Tao context that was created with TaoCreate()
Collective
Input Parameter:
tao- theTaocontext
Level: beginner
See also: Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoDestroy
PETSc.LibPETSc.TaoEstimateActiveBounds — Method
bound_tol::PetscReal,active_lower::IS,active_upper::IS,active_fixed::IS,active::IS,inactive::IS = TaoEstimateActiveBounds(petsclib::PetscLibType, X::AbstractPetscVec, XL::AbstractPetscVec, XU::AbstractPetscVec, G::AbstractPetscVec, S::AbstractPetscVec, W::AbstractPetscVec, steplen::PetscReal)Generates index sets for variables at the lower and upper bounds, as well as fixed variables where lower and upper bounds equal each other.
Input Parameters:
X- solution vectorXL- lower bound vectorXU- upper bound vectorG- unprojected gradientS- step direction with which the active bounds will be estimatedW- work vector of type and size ofXsteplen- the step length at which the active bounds will be estimated (needs to be conservative)
Output Parameters:
bound_tol- tolerance for the bound estimationactive_lower- index set for active variables at the lower boundactive_upper- index set for active variables at the upper boundactive_fixed- index set for fixed variablesactive- index set for all active variablesinactive- complementary index set for inactive variables
Level: developer
See also: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundSolution()
External Links
- PETSc Manual:
Tao/TaoEstimateActiveBounds
PETSc.LibPETSc.TaoFinalizePackage — Method
TaoFinalizePackage(petsclib::PetscLibType)This function destroys everything in the PETSc/Tao interface to the Tao package. It is called from PetscFinalize().
Level: developer
See also: TaoInitializePackage(), PetscFinalize(), TaoRegister(), TaoRegisterAll()
External Links
- PETSc Manual:
Tao/TaoFinalizePackage
PETSc.LibPETSc.TaoGetADMMParentTao — Method
admm_tao::Tao = TaoGetADMMParentTao(petsclib::PetscLibType, tao::AbstractTao)Gets pointer to parent TAOADMM, used by inner subsolver.
Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
admm_tao- the parentTaocontext
Level: advanced
See also: TAOADMM
External Links
- PETSc Manual:
Tao/TaoGetADMMParentTao
PETSc.LibPETSc.TaoGetApplicationContext — Method
ctx::Ptr{Cvoid} = TaoGetApplicationContext(petsclib::PetscLibType, tao::AbstractTao)Gets the user-defined context for a Tao solver provided with TaoSetApplicationContext()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
ctx- a pointer to the application context
Level: intermediate
See also: Tao, TaoSetApplicationContext()
External Links
- PETSc Manual:
Tao/TaoGetApplicationContext
PETSc.LibPETSc.TaoGetConstraintTolerances — Method
catol::PetscReal,crtol::PetscReal = TaoGetConstraintTolerances(petsclib::PetscLibType, tao::AbstractTao)Gets constraint tolerance parameters used in TaoSolve() convergence tests
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
catol- absolute constraint tolerance, constraint norm must be less thancatolfor used forgatolconvergence criteriacrtol- relative constraint tolerance, constraint norm must be less thancrtolfor used forgatol,gttolconvergence criteria
Level: intermediate
See also: Tao, TaoConvergedReason, TaoGetTolerances(), TaoSetTolerances(), TaoSetConstraintTolerances()
External Links
- PETSc Manual:
Tao/TaoGetConstraintTolerances
PETSc.LibPETSc.TaoGetConvergedReason — Method
reason::TaoConvergedReason = TaoGetConvergedReason(petsclib::PetscLibType, tao::AbstractTao)Gets the reason the TaoSolve() was stopped.
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
reason- value ofTaoConvergedReason
Level: intermediate
See also: Tao, TaoConvergedReason, TaoSetConvergenceTest(), TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoGetConvergedReason
PETSc.LibPETSc.TaoGetConvergenceHistory — Method
obj::Ptr{PetscReal},resid::Ptr{PetscReal},cnorm::Ptr{PetscReal},lits::Ptr{PetscInt},nhist::PetscInt = TaoGetConvergenceHistory(petsclib::PetscLibType, tao::AbstractTao)Gets the arrays used that hold the convergence history.
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
obj- array used to hold objective value historyresid- array used to hold residual historycnorm- array used to hold constraint violation historylits- integer array used to hold linear solver iteration countnhist- size ofobj,resid,cnorm, andlits
Level: advanced
See also: Tao, TaoSolve(), TaoSetConvergenceHistory()
External Links
- PETSc Manual:
Tao/TaoGetConvergenceHistory
PETSc.LibPETSc.TaoGetCurrentFunctionEvaluations — Method
nfuncs::PetscInt = TaoGetCurrentFunctionEvaluations(petsclib::PetscLibType, tao::AbstractTao)Get current number of function evaluations used by a Tao object
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
nfuncs- the current number of function evaluations (maximum between gradient and function evaluations)
Level: intermediate
See also: Tao, TaoSetMaximumFunctionEvaluations(), TaoGetMaximumFunctionEvaluations(), TaoGetMaximumIterations()
External Links
- PETSc Manual:
Tao/TaoGetCurrentFunctionEvaluations
PETSc.LibPETSc.TaoGetCurrentTrustRegionRadius — Method
radius::PetscReal = TaoGetCurrentTrustRegionRadius(petsclib::PetscLibType, tao::AbstractTao)Gets the current trust region radius.
Not Collective
Input Parameter:
tao- aTaooptimization solver
Output Parameter:
radius- the trust region radius
Level: intermediate
See also: Tao, TaoSetInitialTrustRegionRadius(), TaoGetInitialTrustRegionRadius(), TAONTR
External Links
- PETSc Manual:
Tao/TaoGetCurrentTrustRegionRadius
PETSc.LibPETSc.TaoGetDualVariables — Method
DE::PetscVec,DI::PetscVec = TaoGetDualVariables(petsclib::PetscLibType, tao::AbstractTao)Gets the dual vectors
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
DE- dual variable vector for the lower boundsDI- dual variable vector for the upper bounds
Level: advanced
See also: Tao, TaoComputeDualVariables()
External Links
- PETSc Manual:
Tao/TaoGetDualVariables
PETSc.LibPETSc.TaoGetEqualityConstraintsRoutine — Method
ci::PetscVec = TaoGetEqualityConstraintsRoutine(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the function used to compute equality constraints.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
ci- the vector to internally hold the constraint computationfunc- the bounds computation routinectx- the (optional) user-defined context
Calling sequence of func:
tao- theTaosolverx- point to evaluate equality constraintsci- vector of equality constraints evaluated at xctx- the (optional) user-defined function context
Level: intermediate
See also: Tao, TaoSolve(), TaoGetObjective(), TaoGetGradient(), TaoGetHessian(), TaoGetObjectiveAndGradient(), TaoGetInequalityConstraintsRoutine()
External Links
- PETSc Manual:
Tao/TaoGetEqualityConstraintsRoutine
PETSc.LibPETSc.TaoGetFunctionLowerBound — Method
fmin::PetscReal = TaoGetFunctionLowerBound(petsclib::PetscLibType, tao::AbstractTao)Gets the bound on the solution objective value. When an approximate solution with an objective value below this number has been found, the solver will terminate.
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
fmin- the minimum function value
Level: intermediate
See also: Tao, TaoConvergedReason, TaoSetFunctionLowerBound()
External Links
- PETSc Manual:
Tao/TaoGetFunctionLowerBound
PETSc.LibPETSc.TaoGetGradient — Method
g::PetscVec = TaoGetGradient(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the gradient evaluation routine for the function being optimized
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
g- the vector to internally hold the gradient computationfunc- the gradient functionctx- user-defined context for private data for the gradient evaluation routine
Calling sequence of func:
tao- the optimizerx- input vectorg- gradient value (output)ctx- [optional] user-defined function context
Level: beginner
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetGradient()
External Links
- PETSc Manual:
Tao/TaoGetGradient
PETSc.LibPETSc.TaoGetGradientNorm — Method
M::PetscMat = TaoGetGradientNorm(petsclib::PetscLibType, tao::AbstractTao)Returns the matrix used to define the norm used for measuring the size of the gradient in some of the Tao algorithms
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
M- gradient norm
Level: beginner
See also: Tao, TaoSetGradientNorm(), TaoGradientNorm()
External Links
- PETSc Manual:
Tao/TaoGetGradientNorm
PETSc.LibPETSc.TaoGetHessian — Method
H::PetscMat,Hpre::PetscMat = TaoGetHessian(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the function to compute the Hessian as well as the location to store the matrix.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
H- Matrix used for the hessianHpre- Matrix that will be used to construct the preconditioner, can be the same asHfunc- Hessian evaluation routinectx- user-defined context for private data for the Hessian evaluation routine
Calling sequence of func:
tao- theTaocontextx- input vectorH- Hessian matrixHpre- matrix used to construct the preconditioner, usually the same asHctx- [optional] user-defined Hessian context
Level: beginner
See also: Tao, TaoType, TaoGetObjective(), TaoGetGradient(), TaoGetObjectiveAndGradient(), TaoSetHessian(), TaoGetHessianMatrices()
External Links
- PETSc Manual:
Tao/TaoGetHessian
PETSc.LibPETSc.TaoGetHessianMatrices — Method
H::PetscMat,Hpre::PetscMat = TaoGetHessianMatrices(petsclib::PetscLibType, tao::AbstractTao)Get the matrices that store the Hessian matrix and its (optional) approximation that is used to construct the preconditioner
Not collective
Input Parameter:
tao- theTaocontext
Output Parameters:
H- the Hessian matrixHpre- approximation to the Hessian matrix used to construct the preconditioner (oftenH)
Level: intermediate
See also: Tao, TaoType, TaoGetObjective(), TaoGetGradient(), TaoGetObjectiveAndGradient(), TaoSetHessian(), TaoGetHessian()
External Links
- PETSc Manual:
Tao/TaoGetHessianMatrices
PETSc.LibPETSc.TaoGetInequalityBounds — Method
IL::PetscVec,IU::PetscVec = TaoGetInequalityBounds(petsclib::PetscLibType, tao::AbstractTao)Gets the upper and lower bounds set via TaoSetInequalityBounds()
Logically Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
IL- vector of lower boundsIU- vector of upper bounds
Level: beginner
See also: TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetInequalityBounds()
External Links
- PETSc Manual:
Tao/TaoGetInequalityBounds
PETSc.LibPETSc.TaoGetInequalityConstraintsRoutine — Method
ci::PetscVec = TaoGetInequalityConstraintsRoutine(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the function used to compute inequality constraints.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
ci- the vector to internally hold the constraint computationfunc- the bounds computation routinectx- the (optional) user-defined context
Calling sequence of func:
tao- theTaosolverx- point to evaluate inequality constraintsci- vector of inequality constraints evaluated at xctx- the (optional) user-defined function context
Level: intermediate
See also: Tao, TaoSolve(), TaoGetObjective(), TaoGetGradient(), TaoGetHessian(), TaoGetObjectiveAndGradient(), TaoGetEqualityConstraintsRoutine()
External Links
- PETSc Manual:
Tao/TaoGetInequalityConstraintsRoutine
PETSc.LibPETSc.TaoGetInitialTrustRegionRadius — Method
radius::PetscReal = TaoGetInitialTrustRegionRadius(petsclib::PetscLibType, tao::AbstractTao)Gets the initial trust region radius.
Not Collective
Input Parameter:
tao- aTaooptimization solver
Output Parameter:
radius- the trust region radius
Level: intermediate
See also: Tao, TaoSetInitialTrustRegionRadius(), TaoGetCurrentTrustRegionRadius(), TAONTR
External Links
- PETSc Manual:
Tao/TaoGetInitialTrustRegionRadius
PETSc.LibPETSc.TaoGetIterationNumber — Method
iter::PetscInt = TaoGetIterationNumber(petsclib::PetscLibType, tao::AbstractTao)Gets the number of TaoSolve() iterations completed at this time.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
iter- iteration number
See also: Tao, TaoGetLinearSolveIterations(), TaoGetResidualNorm(), TaoGetObjective()
External Links
- PETSc Manual:
Tao/TaoGetIterationNumber
PETSc.LibPETSc.TaoGetJacobianEqualityRoutine — Method
J::PetscMat,Jpre::PetscMat = TaoGetJacobianEqualityRoutine(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the function used to compute equality constraint Jacobian.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
J- the matrix to internally hold the constraint computationJpre- the matrix used to construct the preconditionerfunc- Jacobian evaluation routinectx- the (optional) user-defined context
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoComputeJacobianEquality(), TaoSetJacobianEqualityRoutine()
External Links
- PETSc Manual:
Tao/TaoGetJacobianEqualityRoutine
PETSc.LibPETSc.TaoGetJacobianInequalityRoutine — Method
J::PetscMat,Jpre::PetscMat = TaoGetJacobianInequalityRoutine(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the function used to compute inequality constraint Jacobian.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
J- the matrix to internally hold the constraint computationJpre- the matrix used to construct the preconditionerfunc- Jacobian evaluation routinectx- the (optional) user-defined context
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoComputeJacobianInequality(), TaoSetJacobianInequalityRoutine()
External Links
- PETSc Manual:
Tao/TaoGetJacobianInequalityRoutine
PETSc.LibPETSc.TaoGetKSP — Method
ksp::KSP = TaoGetKSP(petsclib::PetscLibType, tao::AbstractTao)Gets the linear solver used by the optimization solver.
Not Collective
Input Parameter:
tao- theTaosolver
Output Parameter:
ksp- theKSPlinear solver used in the optimization solver
Level: intermediate
See also: Tao, KSP
External Links
- PETSc Manual:
Tao/TaoGetKSP
PETSc.LibPETSc.TaoGetLMVMMatrix — Method
B::PetscMat = TaoGetLMVMMatrix(petsclib::PetscLibType, tao::AbstractTao)Returns a pointer to the internal LMVM matrix. Valid only for quasi-Newton family of methods.
Input Parameter:
tao-Taosolver context
Output Parameter:
B- LMVM matrix
Level: advanced
See also: TAOBQNLS, TAOBQNKLS, TAOBQNKTL, TAOBQNKTR, MATLMVM, TaoSetLMVMMatrix()
External Links
- PETSc Manual:
Tao/TaoGetLMVMMatrix
PETSc.LibPETSc.TaoGetLineSearch — Method
ls::TaoLineSearch = TaoGetLineSearch(petsclib::PetscLibType, tao::AbstractTao)Gets the line search used by the optimization solver.
Not Collective
Input Parameter:
tao- theTaosolver
Output Parameter:
ls- the line search used in the optimization solver
Level: intermediate
See also: Tao, TaoLineSearch, TaoLineSearchType
External Links
- PETSc Manual:
Tao/TaoGetLineSearch
PETSc.LibPETSc.TaoGetLinearSolveIterations — Method
lits::PetscInt = TaoGetLinearSolveIterations(petsclib::PetscLibType, tao::AbstractTao)Gets the total number of linear iterations used by the Tao solver
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
lits- number of linear iterations
Level: intermediate
See also: Tao, TaoGetKSP()
External Links
- PETSc Manual:
Tao/TaoGetLinearSolveIterations
PETSc.LibPETSc.TaoGetMaximumFunctionEvaluations — Method
nfcn::PetscInt = TaoGetMaximumFunctionEvaluations(petsclib::PetscLibType, tao::AbstractTao)Gets a maximum number of function evaluations allowed for a TaoSolve()
Logically Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
nfcn- the maximum number of function evaluations
Level: intermediate
See also: Tao, TaoSetMaximumFunctionEvaluations(), TaoGetMaximumIterations()
External Links
- PETSc Manual:
Tao/TaoGetMaximumFunctionEvaluations
PETSc.LibPETSc.TaoGetMaximumIterations — Method
maxits::PetscInt = TaoGetMaximumIterations(petsclib::PetscLibType, tao::AbstractTao)Gets a maximum number of iterates that will be used
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
maxits- the maximum number of iterates
Level: intermediate
See also: Tao, TaoSetMaximumIterations(), TaoGetMaximumFunctionEvaluations()
External Links
- PETSc Manual:
Tao/TaoGetMaximumIterations
PETSc.LibPETSc.TaoGetObjective — Method
TaoGetObjective(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the function evaluation routine for the function to be minimized
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
func- the objective functionctx- the user-defined context for private data for the function evaluation
Calling sequence of func:
tao- the optimizerx- input vectorf- function valuectx- [optional] user-defined function context
Level: beginner
See also: Tao, TaoSetGradient(), TaoSetHessian(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoGetObjective
PETSc.LibPETSc.TaoGetObjectiveAndGradient — Method
g::PetscVec = TaoGetObjectiveAndGradient(petsclib::PetscLibType, tao::AbstractTao, noname::Ptr{Cvoid})Gets the combined objective function and gradient evaluation routine for the function to be optimized
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
g- the vector to internally hold the gradient computationfunc- the gradient functionctx- user-defined context for private data for the gradient evaluation routine
Calling sequence of func:
tao- the optimizerx- input vectorf- objective value (output)g- gradient value (output)ctx- [optional] user-defined function context
Level: beginner
See also: Tao, TaoSolve(), TaoSetObjective(), TaoSetGradient(), TaoSetHessian(), TaoSetObjectiveAndGradient()
External Links
- PETSc Manual:
Tao/TaoGetObjectiveAndGradient
PETSc.LibPETSc.TaoGetOptionsPrefix — Method
p::String = TaoGetOptionsPrefix(petsclib::PetscLibType, tao::AbstractTao)Gets the prefix used for searching for all Tao options in the database
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
p- pointer to the prefix string used is returned
Level: advanced
See also: Tao, TaoSetFromOptions(), TaoSetOptionsPrefix(), TaoAppendOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoGetOptionsPrefix
PETSc.LibPETSc.TaoGetRecycleHistory — Method
recycle::PetscBool = TaoGetRecycleHistory(petsclib::PetscLibType, tao::AbstractTao)Retrieve the boolean flag for re-using iterate information from the previous TaoSolve(). This feature is disabled by default.
Logically Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
recycle- boolean flag
Level: intermediate
See also: Tao, TaoSetRecycleHistory(), TAOBNCG, TAOBQNLS, TAOBQNKLS, TAOBQNKTR, TAOBQNKTL
External Links
- PETSc Manual:
Tao/TaoGetRecycleHistory
PETSc.LibPETSc.TaoGetResidualNorm — Method
value::PetscReal = TaoGetResidualNorm(petsclib::PetscLibType, tao::AbstractTao)Gets the current value of the norm of the residual (gradient) at this time.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
value- the current value
Level: intermediate
See also: Tao, TaoGetLinearSolveIterations(), TaoGetIterationNumber(), TaoGetObjective()
External Links
- PETSc Manual:
Tao/TaoGetResidualNorm
PETSc.LibPETSc.TaoGetSolution — Method
X::PetscVec = TaoGetSolution(petsclib::PetscLibType, tao::AbstractTao)Returns the vector with the current solution from the Tao object
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
X- the current solution
Level: intermediate
See also: Tao, TaoSetSolution(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoGetSolution
PETSc.LibPETSc.TaoGetSolutionStatus — Method
its::PetscInt,f::PetscReal,gnorm::PetscReal,cnorm::PetscReal,xdiff::PetscReal,reason::TaoConvergedReason = TaoGetSolutionStatus(petsclib::PetscLibType, tao::AbstractTao)Get the current iterate, objective value, residual, infeasibility, and termination from a Tao object
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
its- the current iterate number (>=0)f- the current function valuegnorm- the square of the gradient norm, duality gap, or other measure indicating distance from optimality.cnorm- the infeasibility of the current solution with regard to the constraints.xdiff- the step length or trust region radius of the most recent iterate.reason- The termination reason, which can equalTAO_CONTINUE_ITERATING
Level: intermediate
See also: TaoMonitor(), TaoGetConvergedReason()
External Links
- PETSc Manual:
Tao/TaoGetSolutionStatus
PETSc.LibPETSc.TaoGetTerm — Method
scale::PetscReal,term::TaoTerm,params::PetscVec,map::PetscMat = TaoGetTerm(petsclib::PetscLibType, tao::AbstractTao)Get the entire objective function of the Tao as a single TaoTerm in the form \alpha f(Ax; p), where \alpha is a scaling coefficient, f is a TaoTerm, A is an (optional) map and p are the parameters of f.
Not collective
Input Parameter:
tao- aTaocontext
Output Parameters:
scale- the scale of the termterm- aTaoTermfor the real-valued function defining the objectiveparams- the vector of parameters forterm, orNULLif no parameters were specified fortermmap- a map from the solution space oftaoto the solution space ofterm, ifNULLthen the map is the identity
Level: intermediate
See also: Tao, TaoTerm, TAOTERMSUM, TaoAddTerm()
External Links
- PETSc Manual:
Tao/TaoGetTerm
PETSc.LibPETSc.TaoGetTolerances — Method
gatol::PetscReal,grtol::PetscReal,gttol::PetscReal = TaoGetTolerances(petsclib::PetscLibType, tao::AbstractTao)gets the current values of some tolerances used for the convergence testing of TaoSolve()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
gatol- stop if norm of gradient is less than thisgrtol- stop if relative norm of gradient is less than thisgttol- stop if norm of gradient is reduced by a this factor
Level: intermediate
See also: Tao, TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoGetTolerances
PETSc.LibPETSc.TaoGetTotalIterationNumber — Method
iter::PetscInt = TaoGetTotalIterationNumber(petsclib::PetscLibType, tao::AbstractTao)Gets the total number of TaoSolve() iterations completed. This number keeps accumulating if multiple solves are called with the Tao object.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
iter- number of iterations
Level: intermediate
See also: Tao, TaoGetLinearSolveIterations()
External Links
- PETSc Manual:
Tao/TaoGetTotalIterationNumber
PETSc.LibPETSc.TaoGetType — Method
type::String = TaoGetType(petsclib::PetscLibType, tao::AbstractTao)Gets the current TaoType being used in the Tao object
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
type- theTaoType
Level: intermediate
See also: Tao, TaoType, TaoSetType(), PetscObjectTypeCompare(), PetscObjectTypeCompareAny()
External Links
- PETSc Manual:
Tao/TaoGetType
PETSc.LibPETSc.TaoGetVariableBounds — Method
XL::PetscVec,XU::PetscVec = TaoGetVariableBounds(petsclib::PetscLibType, tao::AbstractTao)Gets the upper and lower bounds vectors set with TaoSetVariableBounds()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
XL- vector of lower boundsXU- vector of upper bounds
Level: beginner
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoGetVariableBounds
PETSc.LibPETSc.TaoGradientNorm — Method
gnorm::PetscReal = TaoGradientNorm(petsclib::PetscLibType, tao::AbstractTao, gradient::AbstractPetscVec, type::NormType)Compute the norm using the NormType, the user has selected
Collective
Input Parameters:
tao- theTaocontextgradient- the gradienttype- the norm type
Output Parameter:
gnorm- the gradient norm
Level: advanced
See also: Tao, TaoSetGradientNorm(), TaoGetGradientNorm()
External Links
- PETSc Manual:
Tao/TaoGradientNorm
PETSc.LibPETSc.TaoInitializePackage — Method
TaoInitializePackage(petsclib::PetscLibType)This function sets up PETSc to use the Tao package. When using static or shared libraries, this function is called from the first entry to TaoCreate(); when using shared or static libraries, it is called from PetscDLLibraryRegister_tao()
Level: developer
See also: TaoCreate(), TaoFinalizePackage(), TaoRegister(), TaoRegisterAll()
External Links
- PETSc Manual:
Sys/TaoInitializePackage
PETSc.LibPETSc.TaoIsGradientDefined — Method
flg::PetscBool = TaoIsGradientDefined(petsclib::PetscLibType, tao::AbstractTao)Checks to see if the user has declared a gradient-only routine. Useful for determining when it is appropriate to call TaoComputeGradient() or TaoComputeObjectiveAndGradient()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
flg-PETSC_TRUEif the objectiveTaoTermhas this routine,PETSC_FALSEotherwise
Level: developer
See also: TaoSetGradient(), TaoIsObjectiveDefined(), TaoIsObjectiveAndGradientDefined()
External Links
- PETSc Manual:
Tao/TaoIsGradientDefined
PETSc.LibPETSc.TaoIsObjectiveAndGradientDefined — Method
flg::PetscBool = TaoIsObjectiveAndGradientDefined(petsclib::PetscLibType, tao::AbstractTao)Checks to see if the user has declared a joint objective/gradient routine. Useful for determining when it is appropriate to call TaoComputeObjectiveAndGradient()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
flg-PETSC_TRUEif the objectiveTaoTermhas this routinePETSC_FALSEotherwise
Level: developer
See also: TaoSetObjectiveAndGradient(), TaoIsObjectiveDefined(), TaoIsGradientDefined()
External Links
- PETSc Manual:
Tao/TaoIsObjectiveAndGradientDefined
PETSc.LibPETSc.TaoIsObjectiveDefined — Method
flg::PetscBool = TaoIsObjectiveDefined(petsclib::PetscLibType, tao::AbstractTao)Checks to see if the user has declared an objective-only routine. Useful for determining when it is appropriate to call TaoComputeObjective() or TaoComputeObjectiveAndGradient()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
flg-PETSC_TRUEif theTaohas this routinePETSC_FALSEotherwise
Level: developer
See also: Tao, TaoSetObjective(), TaoIsGradientDefined(), TaoIsObjectiveAndGradientDefined()
External Links
- PETSc Manual:
Tao/TaoIsObjectiveDefined
PETSc.LibPETSc.TaoKSPSetUseEW — Method
TaoKSPSetUseEW(petsclib::PetscLibType, tao::AbstractTao, flag::PetscBool)Sets SNES to use Eisenstat-Walker method {cite}ew96 for computing relative tolerance for linear solvers.
Logically Collective
Input Parameters:
tao- Tao contextflag-PETSC_TRUEorPETSC_FALSE
Level: advanced
See also: Tao, SNESKSPSetUseEW()
External Links
- PETSc Manual:
Tao/TaoKSPSetUseEW
PETSc.LibPETSc.TaoLMVMGetH0 — Method
H0::PetscMat = TaoLMVMGetH0(petsclib::PetscLibType, tao::AbstractTao)Get the matrix object for the QN initial Hessian
Input Parameter:
tao- theTaosolver context
Output Parameter:
H0-Matobject for the initial Hessian
Level: advanced
See also: Tao, TAOLMVM, TAOBLMVM, TaoLMVMSetH0(), TaoLMVMGetH0KSP()
External Links
- PETSc Manual:
Tao/TaoLMVMGetH0
PETSc.LibPETSc.TaoLMVMGetH0KSP — Method
ksp::KSP = TaoLMVMGetH0KSP(petsclib::PetscLibType, tao::AbstractTao)Get the iterative solver for applying the inverse of the QN initial Hessian
Input Parameter:
tao- theTaosolver context
Output Parameter:
ksp-KSPsolver context for the initial Hessian
Level: advanced
See also: Tao, TAOLMVM, TAOBLMVM, TaoLMVMGetH0()
External Links
- PETSc Manual:
Tao/TaoLMVMGetH0KSP
PETSc.LibPETSc.TaoLMVMRecycle — Method
TaoLMVMRecycle(petsclib::PetscLibType, tao::AbstractTao, flg::PetscBool)Enable/disable recycling of the QN history between subsequent TaoSolve() calls.
Input Parameters:
tao- theTaosolver contextflg- Boolean flag for recycling (PETSC_TRUEorPETSC_FALSE)
Level: intermediate
See also: Tao, TAOLMVM, TAOBLMVM
External Links
- PETSc Manual:
Tao/TaoLMVMRecycle
PETSc.LibPETSc.TaoLMVMSetH0 — Method
TaoLMVMSetH0(petsclib::PetscLibType, tao::AbstractTao, H0::AbstractPetscMat)Set the initial Hessian for the QN approximation
Input Parameters:
tao- theTaosolver contextH0-Matobject for the initial Hessian
Level: advanced
See also: Tao, TAOLMVM, TAOBLMVM, TaoLMVMGetH0(), TaoLMVMGetH0KSP()
External Links
- PETSc Manual:
Tao/TaoLMVMSetH0
PETSc.LibPETSc.TaoMatGetSubMat — Method
Msub::PetscMat = TaoMatGetSubMat(petsclib::PetscLibType, M::AbstractPetscMat, is::AbstractIS, v1::AbstractPetscVec, subset_type::TaoSubsetType)Gets a submatrix using the IS
Input Parameters:
M- the full matrix (n x n)is- the index set for the submatrix (both row and column index sets need to be the same)v1- work vector of dimension n, needed forTAO_SUBSET_MASKoptionsubset_type- the methodTaois using for subsetting
Output Parameter:
Msub- the submatrix
Level: developer
See also: TaoVecGetSubVec(), TaoSubsetType
External Links
- PETSc Manual:
Tao/TaoMatGetSubMat
PETSc.LibPETSc.TaoMonitor — Method
TaoMonitor(petsclib::PetscLibType, tao::AbstractTao, its::PetscInt, f::PetscReal, res::PetscReal, cnorm::PetscReal, steplength::PetscReal)Monitor the solver and the current solution. This routine will record the iteration number and residual statistics, and call any monitors specified by the user.
Input Parameters:
tao- theTaocontextits- the current iterate number (>=0)f- the current objective function valueres- the gradient norm, square root of the duality gap, or other measure indicating distance from optimality. This measure will be recorded and
used for some termination tests.
cnorm- the infeasibility of the current solution with regard to the constraints.steplength- multiple of the step direction added to the previous iterate.
Options Database Key:
-tao_monitor- Use the default monitor, which prints statistics to standard output
Level: developer
See also: Tao, TaoGetConvergedReason(), TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitor
PETSc.LibPETSc.TaoMonitorCancel — Method
TaoMonitorCancel(petsclib::PetscLibType, tao::AbstractTao)Clears all the monitor functions for a Tao object.
Logically Collective
Input Parameter:
tao- theTaosolver context
Options Database Key:
-tao_monitor_cancel- cancels all monitors that have been hardwired
into a code by calls to TaoMonitorSet(), but does not cancel those set via the options database
Level: advanced
See also: Tao, TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorCancel
PETSc.LibPETSc.TaoMonitorConstraintNorm — Method
TaoMonitorConstraintNorm(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})same as TaoMonitorDefault() except it prints the norm of the constraint function.
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor_constraint_norm- monitor the constraints
Level: advanced
See also: Tao, TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorConstraintNorm
PETSc.LibPETSc.TaoMonitorDefault — Method
TaoMonitorDefault(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})Default routine for monitoring progress of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor- turn on default monitoring
Level: advanced
See also: Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorDefault
PETSc.LibPETSc.TaoMonitorDefaultShort — Method
TaoMonitorDefaultShort(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})Routine for monitoring progress of TaoSolve() that displays fewer digits than TaoMonitorDefault()
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor_short- turn on default short monitoring
Level: advanced
See also: Tao, TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorDefaultShort
PETSc.LibPETSc.TaoMonitorGlobalization — Method
TaoMonitorGlobalization(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})Default routine for monitoring progress of TaoSolve() with extra detail on the globalization method.
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor_globalization- turn on monitoring with globalization information
Level: advanced
See also: Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorGlobalization
PETSc.LibPETSc.TaoMonitorGradient — Method
TaoMonitorGradient(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})Views the gradient at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor_gradient- view the gradient at each iteration
Level: advanced
See also: Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorGradient
PETSc.LibPETSc.TaoMonitorGradientDraw — Method
TaoMonitorGradientDraw(petsclib::PetscLibType, tao::AbstractTao, ctx::Ptr{Cvoid})Plots the gradient at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext
Options Database Key:
-tao_monitor_gradient_draw- draw the gradient at each iteration
Level: advanced
See also: Tao, TaoMonitorGradient(), TaoMonitorSet(), TaoMonitorSolutionDraw()
External Links
- PETSc Manual:
Tao/TaoMonitorGradientDraw
PETSc.LibPETSc.TaoMonitorResidual — Method
TaoMonitorResidual(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})Views the least-squares residual at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor_ls_residual- view the residual at each iteration
Level: advanced
See also: Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorResidual
PETSc.LibPETSc.TaoMonitorSet — Method
TaoMonitorSet(petsclib::PetscLibType, tao::AbstractTao, func::external, ctx::Ptr{Cvoid}, dest::Ptr{Cvoid})Sets an additional function that is to be used at every iteration of the solver to display the iteration's progress.
Logically Collective
Input Parameters:
tao- theTaosolver contextfunc- monitoring routinectx- [optional] user-defined context for private data for the monitor routine (may beNULL)dest- [optional] function to destroy the context when theTaois destroyed, seePetscCtxDestroyFnfor the calling sequence
Calling sequence of func:
tao- theTaosolver contextctx- [optional] monitoring context
Level: intermediate
See also: Tao, TaoSolve(), TaoMonitorDefault(), TaoMonitorCancel(), TaoView(), PetscCtxDestroyFn
External Links
- PETSc Manual:
Tao/TaoMonitorSet
PETSc.LibPETSc.TaoMonitorSetFromOptions — Method
TaoMonitorSetFromOptions(petsclib::PetscLibType, tao::AbstractTao, name::String, help::String, manual::String, monitor::external)Sets a monitor function and viewer appropriate for the type indicated by the user
Collective
Input Parameters:
tao-Taoobject you wish to monitorname- the monitor type one is seekinghelp- message indicating what monitoring is donemanual- manual page for the monitormonitor- the monitor function, this must use aPetscViewerFormatas its context
Level: developer
See also: Tao, TaoMonitorSet(), PetscOptionsCreateViewer(), PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool(), PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHeadBegin(), PetscOptionsStringArray(), PetscOptionsRealArray(), PetscOptionsScalar(), PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), PetscOptionsFList(), PetscOptionsEList()
External Links
- PETSc Manual:
Tao/TaoMonitorSetFromOptions
PETSc.LibPETSc.TaoMonitorSolution — Method
TaoMonitorSolution(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})Views the solution at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor_solution- view the solution
Level: advanced
See also: Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorSolution
PETSc.LibPETSc.TaoMonitorSolutionDraw — Method
TaoMonitorSolutionDraw(petsclib::PetscLibType, tao::AbstractTao, ctx::Ptr{Cvoid})Plots the solution at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx-TaoMonitorDrawcontext
Options Database Key:
-tao_monitor_solution_draw- draw the solution at each iteration
Level: advanced
See also: Tao, TaoMonitorSolution(), TaoMonitorSet(), TaoMonitorGradientDraw(), TaoMonitorDrawCtxCreate(), TaoMonitorDrawCtxDestroy()
External Links
- PETSc Manual:
Tao/TaoMonitorSolutionDraw
PETSc.LibPETSc.TaoMonitorStep — Method
TaoMonitorStep(petsclib::PetscLibType, tao::AbstractTao, vf::Vector{PetscViewerAndFormat})Views the step-direction at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextvf-PetscViewerAndFormatcontext
Options Database Key:
-tao_monitor_step- view the step vector at each iteration
Level: advanced
See also: Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorStep
PETSc.LibPETSc.TaoMonitorStepDraw — Method
TaoMonitorStepDraw(petsclib::PetscLibType, tao::AbstractTao, ctx::Ptr{Cvoid})Plots the step direction at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx- thePetscViewercontext
Options Database Key:
-tao_monitor_step_draw- draw the step direction at each iteration
Level: advanced
See also: Tao, TaoMonitorSet(), TaoMonitorSolutionDraw
External Links
- PETSc Manual:
Tao/TaoMonitorStepDraw
PETSc.LibPETSc.TaoParametersInitialize — Method
TaoParametersInitialize(petsclib::PetscLibType, tao::AbstractTao)Sets all the parameters in tao to their default value (when TaoCreate() was called) if they currently contain default values. Default values are the parameter values when the object's type is set.
Collective
Input Parameter:
tao- theTaoobject
Level: developer
See also: Tao, TaoSolve(), TaoDestroy(), PetscObjectParameterSetDefault()
External Links
- PETSc Manual:
Tao/TaoParametersInitialize
PETSc.LibPETSc.TaoPythonGetType — Method
pyname::String = TaoPythonGetType(petsclib::PetscLibType, tao::AbstractTao)Get the type of a Tao object implemented in Python.
Not Collective
Input Parameter:
tao- the optimization solver (Tao) context.
Output Parameter:
pyname- full dotted Python name [package].module[.{class|function}]
Level: intermediate
See also: TaoCreate(), TaoSetType(), TAOPYTHON, PetscPythonInitialize(), TaoPythonSetType()
External Links
- PETSc Manual:
Tao/TaoPythonGetType
PETSc.LibPETSc.TaoPythonSetType — Method
TaoPythonSetType(petsclib::PetscLibType, tao::AbstractTao, pyname::String)Initialize a Tao object implemented in Python.
Collective
Input Parameters:
tao- the optimization solver (Tao) context.pyname- full dotted Python name [package].module[.{class|function}]
Options Database Key:
-tao_python_type pyname- python class
Level: intermediate
See also: TaoCreate(), TaoSetType(), TAOPYTHON, PetscPythonInitialize()
External Links
- PETSc Manual:
Tao/TaoPythonSetType
PETSc.LibPETSc.TaoRegister — Method
TaoRegister(petsclib::PetscLibType, sname::String, func::external)Adds a method to the Tao package for minimization.
Not Collective, No Fortran Support
Input Parameters:
sname- name of a new user-defined solverfunc- routine to createTaoTypespecific method context
Calling sequence of func:
tao- theTaoobject to be created
See also: Tao, TaoSetType(), TaoRegisterAll(), TaoRegisterDestroy()
External Links
- PETSc Manual:
Tao/TaoRegister
PETSc.LibPETSc.TaoRegisterDestroy — Method
TaoRegisterDestroy(petsclib::PetscLibType)Frees the list of minimization solvers that were registered by TaoRegister().
Not Collective
Level: advanced
See also: Tao, TaoRegisterAll(), TaoRegister()
External Links
- PETSc Manual:
Tao/TaoRegisterDestroy
PETSc.LibPETSc.TaoResetStatistics — Method
TaoResetStatistics(petsclib::PetscLibType, tao::AbstractTao)Initialize the statistics collected by the Tao object. These statistics include the iteration number, residual norms, and convergence status. This routine gets called before solving each optimization problem.
Collective
Input Parameter:
tao- theTaocontext
Level: developer
See also: Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoResetStatistics
PETSc.LibPETSc.TaoSetApplicationContext — Method
TaoSetApplicationContext(petsclib::PetscLibType, tao::AbstractTao, ctx::Ptr{Cvoid})Sets the optional user-defined context for a Tao solver that can be accessed later, for example in the Tao callback functions with TaoGetApplicationContext()
Logically Collective
Input Parameters:
tao- theTaocontextctx- the application context
Level: intermediate
See also: Tao, TaoGetApplicationContext()
External Links
- PETSc Manual:
Tao/TaoSetApplicationContext
PETSc.LibPETSc.TaoSetConstraintTolerances — Method
TaoSetConstraintTolerances(petsclib::PetscLibType, tao::AbstractTao, catol::PetscReal, crtol::PetscReal)Sets constraint tolerance parameters used in TaoSolve() convergence tests
Logically Collective
Input Parameters:
tao- theTaocontextcatol- absolute constraint tolerance, constraint norm must be less thancatolfor used forgatolconvergence criteriacrtol- relative constraint tolerance, constraint norm must be less thancrtolfor used forgatol,gttolconvergence criteria
Options Database Keys:
-tao_catol catol- Sets catol-tao_crtol crtol- Sets crtol
Level: intermediate
See also: Tao, TaoConvergedReason, TaoGetTolerances(), TaoGetConstraintTolerances(), TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoSetConstraintTolerances
PETSc.LibPETSc.TaoSetConstraintsRoutine — Method
TaoSetConstraintsRoutine(petsclib::PetscLibType, tao::AbstractTao, c::AbstractPetscVec, func::external, ctx::Ptr{Cvoid})Sets a function to be used to compute constraints. Tao only handles constraints under certain conditions, see for details
Logically Collective
Input Parameters:
tao- theTaocontextc- A vector that will be used to store constraint evaluationfunc- the bounds computation routinectx- [optional] user-defined context for private data for the constraints computation (may beNULL)
Calling sequence of func:
tao- theTaosolverx- point to evaluate constraintsc- vector constraints evaluated atxctx- the (optional) user-defined function context
Level: intermediate
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariablevBounds()
External Links
- PETSc Manual:
Tao/TaoSetConstraintsRoutine
PETSc.LibPETSc.TaoSetConvergedReason — Method
TaoSetConvergedReason(petsclib::PetscLibType, tao::AbstractTao, reason::TaoConvergedReason)Sets the termination flag on a Tao object
Logically Collective
Input Parameters:
tao- theTaocontextreason- theTaoConvergedReason
Level: intermediate
See also: Tao, TaoConvergedReason
External Links
- PETSc Manual:
Tao/TaoSetConvergedReason
PETSc.LibPETSc.TaoSetConvergenceHistory — Method
TaoSetConvergenceHistory(petsclib::PetscLibType, tao::AbstractTao, obj::Vector{PetscReal}, resid::Vector{PetscReal}, cnorm::Vector{PetscReal}, lits::Vector{PetscInt}, na::PetscInt, reset::PetscBool)Sets the array used to hold the convergence history.
Logically Collective
Input Parameters:
tao- theTaosolver contextobj- array to hold objective value historyresid- array to hold residual historycnorm- array to hold constraint violation historylits- integer array holds the number of linear iterations for each Tao iterationna- size ofobj,resid, andcnormreset-PETSC_TRUEindicates each new minimization resets the history counter to zero,
else it continues storing new values for new minimizations after the old ones
Level: intermediate
See also: TaoGetConvergenceHistory()
External Links
- PETSc Manual:
Tao/TaoSetConvergenceHistory
PETSc.LibPETSc.TaoSetConvergenceTest — Method
TaoSetConvergenceTest(petsclib::PetscLibType, tao::AbstractTao, conv::external, ctx::Ptr{Cvoid})Sets the function that is to be used to test for convergence of the iterative minimization solution. The new convergence testing routine will replace Tao's default convergence test.
Logically Collective
Input Parameters:
tao- theTaoobjectconv- the routine to test for convergencectx- [optional] context for private data for the convergence routine (may beNULL)
Calling sequence of conv:
tao- theTaoobjectctx- [optional] convergence context
Level: advanced
See also: Tao, TaoSolve(), TaoSetConvergedReason(), TaoGetSolutionStatus(), TaoGetTolerances(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoSetConvergenceTest
PETSc.LibPETSc.TaoSetEqualityConstraintsRoutine — Method
TaoSetEqualityConstraintsRoutine(petsclib::PetscLibType, tao::AbstractTao, ce::AbstractPetscVec, func::external, ctx::Ptr{Cvoid})Sets a function to be used to compute constraints. Tao only handles constraints under certain conditions, see for details
Logically Collective
Input Parameters:
tao- theTaocontextce- A vector that will be used to store equality constraint evaluationfunc- the bounds computation routinectx- [optional] user-defined context for private data for the equality constraints computation (may beNULL)
Calling sequence of func:
tao- theTaosolverx- point to evaluate equality constraintsce- vector of equality constraints evaluated at xctx- the (optional) user-defined function context
Level: intermediate
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetEqualityConstraintsRoutine
PETSc.LibPETSc.TaoSetFromOptions — Method
TaoSetFromOptions(petsclib::PetscLibType, tao::AbstractTao)Sets various Tao parameters from the options database
Collective
Input Parameter:
tao- theTaosolver context
Options Database Keys:
-tao_type type- The algorithm that Tao uses (lmvm, nls, etc.). SeeTAOType-tao_gatol gatol- absolute error tolerance for ||gradient||-tao_grtol grtol- relative error tolerance for ||gradient||-tao_gttol gttol- reduction of ||gradient|| relative to initial gradient-tao_max_it max- sets maximum number of iterations-tao_max_funcs max- sets maximum number of function evaluations-tao_fmin fmin- stop if function value reaches fmin-tao_steptol tol- stop if trust region radius less thantol-tao_trust0 radius- initial trust region radius-tao_view_solution- view the solution at the end of the optimization process-tao_monitor- prints function value and residual norm at each iteration-tao_monitor_short- same as-tao_monitor, but truncates very small values-tao_monitor_constraint_norm- prints objective value, gradient, and constraint norm at each iteration-tao_monitor_globalization- prints information about the globalization at each iteration-tao_monitor_solution- prints solution vector at each iteration-tao_monitor_ls_residual- prints least-squares residual vector at each iteration-tao_monitor_step- prints step vector at each iteration-tao_monitor_gradient- prints gradient vector at each iteration-tao_monitor_solution_draw- graphically view solution vector at each iteration-tao_monitor_step_draw- graphically view step vector at each iteration-tao_monitor_gradient_draw- graphically view gradient at each iteration-tao_monitor_cancel- cancels all monitors (except those set with command line)-tao_fd_gradient- use gradient computed with finite differences-tao_fd_hessian- use hessian computed with finite differences-tao_mf_hessian- use matrix-free Hessian computed with finite differences. NoTaoTermsupport-tao_view- prints information about the Tao after solving-tao_converged_reason- prints the reason Tao stopped iterating-tao_add_terms- takes a comma-separated list of up to 16 options prefixes, aTaoTermwill be created for each and added to the objective function
Level: beginner
See also: Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoSetFromOptions
PETSc.LibPETSc.TaoSetFunctionLowerBound — Method
TaoSetFunctionLowerBound(petsclib::PetscLibType, tao::AbstractTao, fmin::PetscReal)Sets a bound on the solution objective value. When an approximate solution with an objective value below this number has been found, the solver will terminate.
Logically Collective
Input Parameters:
tao- the Tao solver contextfmin- the tolerance
Options Database Key:
-tao_fmin fmin- sets the minimum function value
Level: intermediate
See also: Tao, TaoConvergedReason, TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoSetFunctionLowerBound
PETSc.LibPETSc.TaoSetGradient — Method
TaoSetGradient(petsclib::PetscLibType, tao::AbstractTao, g::AbstractPetscVec, func::external, ctx::Ptr{Cvoid})Sets the gradient evaluation routine for the function to be optimized
Logically Collective
Input Parameters:
tao- theTaocontextg- [optional] the vector to internally hold the gradient computationfunc- the gradient functionctx- [optional] user-defined context for private data for the gradient evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimization solverx- input vectorg- gradient value (output)ctx- [optional] user-defined function context
Level: beginner
See also: Tao, TaoSolve(), TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetGradient()
External Links
- PETSc Manual:
Tao/TaoSetGradient
PETSc.LibPETSc.TaoSetGradientNorm — Method
TaoSetGradientNorm(petsclib::PetscLibType, tao::AbstractTao, M::AbstractPetscMat)Sets the matrix used to define the norm that measures the size of the gradient in some of the Tao algorithms
Collective
Input Parameters:
tao- theTaocontextM- matrix that defines the norm
Level: beginner
See also: Tao, TaoGetGradientNorm(), TaoGradientNorm()
External Links
- PETSc Manual:
Tao/TaoSetGradientNorm
PETSc.LibPETSc.TaoSetHessian — Method
TaoSetHessian(petsclib::PetscLibType, tao::AbstractTao, H::AbstractPetscMat, Hpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the function to compute the Hessian as well as the location to store the matrix.
Logically Collective
Input Parameters:
tao- theTaocontextH- Matrix used for the hessianHpre- Matrix that will be used to construct the preconditioner, can be same asHfunc- Hessian evaluation routinectx- [optional] user-defined context for private data for the
Hessian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorH- Hessian matrixHpre- matrix used to construct the preconditioner, usually the same asHctx- [optional] user-defined Hessian context
Level: beginner
See also: Tao, TaoType, TaoSetObjective(), TaoSetGradient(), TaoSetObjectiveAndGradient(), TaoGetHessian()
External Links
- PETSc Manual:
Tao/TaoSetHessian
PETSc.LibPETSc.TaoSetInequalityBounds — Method
TaoSetInequalityBounds(petsclib::PetscLibType, tao::AbstractTao, IL::AbstractPetscVec, IU::AbstractPetscVec)Sets the upper and lower bounds
Logically Collective
Input Parameters:
tao- theTaocontextIL- vector of lower boundsIU- vector of upper bounds
Level: beginner
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetInequalityBounds()
External Links
- PETSc Manual:
Tao/TaoSetInequalityBounds
PETSc.LibPETSc.TaoSetInequalityConstraintsRoutine — Method
TaoSetInequalityConstraintsRoutine(petsclib::PetscLibType, tao::AbstractTao, ci::AbstractPetscVec, func::external, ctx::Ptr{Cvoid})Sets a function to be used to compute constraints. Tao only handles constraints under certain conditions, see for details
Logically Collective
Input Parameters:
tao- theTaocontextci- A vector that will be used to store inequality constraint evaluationfunc- the bounds computation routinectx- [optional] user-defined context for private data for the inequality constraints computation (may beNULL)
Calling sequence of func:
tao- theTaosolverx- point to evaluate inequality constraintsci- vector of inequality constraints evaluated at xctx- the (optional) user-defined function context
Level: intermediate
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetInequalityConstraintsRoutine
PETSc.LibPETSc.TaoSetInitialTrustRegionRadius — Method
TaoSetInitialTrustRegionRadius(petsclib::PetscLibType, tao::AbstractTao, radius::PetscReal)Sets the initial trust region radius.
Logically Collective
Input Parameters:
tao- aTaooptimization solverradius- the trust region radius
Options Database Key:
-tao_trust0 radius- sets initial trust region radius
Level: intermediate
See also: Tao, TaoGetTrustRegionRadius(), TaoSetTrustRegionTolerance(), TAONTR
External Links
- PETSc Manual:
Tao/TaoSetInitialTrustRegionRadius
PETSc.LibPETSc.TaoSetIterationNumber — Method
TaoSetIterationNumber(petsclib::PetscLibType, tao::AbstractTao, iter::PetscInt)Sets the current iteration number.
Logically Collective
Input Parameters:
tao- theTaocontextiter- iteration number
Level: developer
See also: Tao, TaoGetLinearSolveIterations()
External Links
- PETSc Manual:
Tao/TaoSetIterationNumber
PETSc.LibPETSc.TaoSetJacobianDesignRoutine — Method
TaoSetJacobianDesignRoutine(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the function to compute the Jacobian of the constraint function with respect to the design variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the Jacobianfunc- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoComputeJacobianDesign(), TaoSetJacobianStateRoutine(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianDesignRoutine
PETSc.LibPETSc.TaoSetJacobianEqualityRoutine — Method
TaoSetJacobianEqualityRoutine(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, Jpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the function to compute the Jacobian (and its inverse) of the constraint function with respect to the equality variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJ.func- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoComputeJacobianEquality(), TaoSetJacobianDesignRoutine(), TaoSetEqualityDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianEqualityRoutine
PETSc.LibPETSc.TaoSetJacobianInequalityRoutine — Method
TaoSetJacobianInequalityRoutine(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, Jpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the function to compute the Jacobian (and its inverse) of the constraint function with respect to the inequality variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJ.func- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoComputeJacobianInequality(), TaoSetJacobianDesignRoutine(), TaoSetInequalityDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianInequalityRoutine
PETSc.LibPETSc.TaoSetJacobianResidualRoutine — Method
TaoSetJacobianResidualRoutine(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, Jpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the function to compute the least-squares residual Jacobian as well as the location to store the matrix.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the jacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJfunc- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoSetGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoSetJacobianResidualRoutine
PETSc.LibPETSc.TaoSetJacobianRoutine — Method
TaoSetJacobianRoutine(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, Jpre::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the function to compute the Jacobian as well as the location to store the matrix.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJfunc- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoSetGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoSetJacobianRoutine
PETSc.LibPETSc.TaoSetJacobianStateRoutine — Method
TaoSetJacobianStateRoutine(petsclib::PetscLibType, tao::AbstractTao, J::AbstractPetscMat, Jpre::AbstractPetscMat, Jinv::AbstractPetscMat, func::external, ctx::Ptr{Cvoid})Sets the function to compute the Jacobian (and its inverse) of the constraint function with respect to the state variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJ. Only used ifJinvisNULLJinv- [optional] Matrix used to apply the inverse of the state Jacobian. UseNULLto default to PETScKSPsolvers to apply the inverse.func- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJJinv- inverse ofJctx- [optional] user-defined Jacobian context
Level: intermediate
See also: Tao, TaoComputeJacobianState(), TaoSetJacobianDesignRoutine(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianStateRoutine
PETSc.LibPETSc.TaoSetLMVMMatrix — Method
TaoSetLMVMMatrix(petsclib::PetscLibType, tao::AbstractTao, B::AbstractPetscMat)Sets an external LMVM matrix into the Tao solver. Valid only for quasi-Newton family of methods.
QN family of methods create their own LMVM matrices and users who wish to manipulate this matrix should use TaoGetLMVMMatrix() instead.
Input Parameters:
tao- Tao solver contextB- LMVM matrix
Level: advanced
See also: TAOBQNLS, TAOBQNKLS, TAOBQNKTL, TAOBQNKTR, MATLMVM, TaoGetLMVMMatrix()
External Links
- PETSc Manual:
Tao/TaoSetLMVMMatrix
PETSc.LibPETSc.TaoSetMaximumFunctionEvaluations — Method
TaoSetMaximumFunctionEvaluations(petsclib::PetscLibType, tao::AbstractTao, nfcn::PetscInt)Sets a maximum number of function evaluations allowed for a TaoSolve().
Logically Collective
Input Parameters:
tao- theTaosolver contextnfcn- the maximum number of function evaluations (>=0), usePETSC_UNLIMITEDto have no bound
Options Database Key:
-tao_max_funcs nfcn- sets the maximum number of function evaluations
Level: intermediate
See also: Tao, TaoSetTolerances(), TaoSetMaximumIterations()
External Links
- PETSc Manual:
Tao/TaoSetMaximumFunctionEvaluations
PETSc.LibPETSc.TaoSetMaximumIterations — Method
TaoSetMaximumIterations(petsclib::PetscLibType, tao::AbstractTao, maxits::PetscInt)Sets a maximum number of iterates to be used in TaoSolve()
Logically Collective
Input Parameters:
tao- theTaosolver contextmaxits- the maximum number of iterates (>=0), usePETSC_UNLIMITEDto have no bound
Options Database Key:
-tao_max_it its- sets the maximum number of iterations
Level: intermediate
See also: Tao, TaoSetTolerances(), TaoSetMaximumFunctionEvaluations()
External Links
- PETSc Manual:
Tao/TaoSetMaximumIterations
PETSc.LibPETSc.TaoSetObjective — Method
TaoSetObjective(petsclib::PetscLibType, tao::AbstractTao, func::external, ctx::Ptr{Cvoid})Sets the function evaluation routine for minimization
Logically Collective
Input Parameters:
tao- theTaocontextfunc- the objective functionctx- [optional] user-defined context for private data for the function evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimizerx- input vectorf- function valuectx- [optional] user-defined function context
Level: beginner
See also: TaoSetGradient(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetObjective()
External Links
- PETSc Manual:
Tao/TaoSetObjective
PETSc.LibPETSc.TaoSetObjectiveAndGradient — Method
TaoSetObjectiveAndGradient(petsclib::PetscLibType, tao::AbstractTao, g::AbstractPetscVec, func::external, ctx::Ptr{Cvoid})Sets a combined objective function and gradient evaluation routine for the function to be optimized
Logically Collective
Input Parameters:
tao- theTaocontextg- [optional] the vector to internally hold the gradient computationfunc- the gradient functionctx- [optional] user-defined context for private data for the gradient evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimization objectx- input vectorf- objective value (output)g- gradient value (output)ctx- [optional] user-defined function context
Level: beginner
See also: Tao, TaoSolve(), TaoSetObjective(), TaoSetHessian(), TaoSetGradient(), TaoGetObjectiveAndGradient()
External Links
- PETSc Manual:
Tao/TaoSetObjectiveAndGradient
PETSc.LibPETSc.TaoSetOptionsPrefix — Method
TaoSetOptionsPrefix(petsclib::PetscLibType, tao::AbstractTao, p::String)Sets the prefix used for searching for all Tao options in the database.
Logically Collective
Input Parameters:
tao- theTaocontextp- the prefix string to prepend to all Tao option requests
Level: advanced
See also: Tao, TaoSetFromOptions(), TaoAppendOptionsPrefix(), TaoGetOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoSetOptionsPrefix
PETSc.LibPETSc.TaoSetRecycleHistory — Method
TaoSetRecycleHistory(petsclib::PetscLibType, tao::AbstractTao, recycle::PetscBool)Sets the boolean flag to enable/disable re-using iterate information from the previous TaoSolve(). This feature is disabled by default.
Logically Collective
Input Parameters:
tao- theTaocontextrecycle- boolean flag
Options Database Key:
-tao_recycle_history (true|false)- reuse the history
Level: intermediate
See also: Tao, TaoGetRecycleHistory(), TAOBNCG, TAOBQNLS, TAOBQNKLS, TAOBQNKTR, TAOBQNKTL
External Links
- PETSc Manual:
Tao/TaoSetRecycleHistory
PETSc.LibPETSc.TaoSetResidualRoutine — Method
TaoSetResidualRoutine(petsclib::PetscLibType, tao::AbstractTao, res::AbstractPetscVec, func::external, ctx::Ptr{Cvoid})Sets the residual evaluation routine for least-square applications
Logically Collective
Input Parameters:
tao- theTaocontextres- the residual vectorfunc- the residual evaluation routinectx- [optional] user-defined context for private data for the function evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimizerx- input vectorres- function value vectorctx- [optional] user-defined function context
Level: beginner
See also: Tao, TaoSetObjective(), TaoSetJacobianRoutine()
External Links
- PETSc Manual:
Tao/TaoSetResidualRoutine
PETSc.LibPETSc.TaoSetResidualWeights — Method
rows::PetscInt,cols::PetscInt,vals::PetscReal = TaoSetResidualWeights(petsclib::PetscLibType, tao::AbstractTao, sigma_v::AbstractPetscVec, n::PetscInt)Give weights for the residual values. A vector can be used if only diagonal terms are used, otherwise a matrix can be give.
Collective
Input Parameters:
tao- theTaocontextsigma_v- vector of weights (diagonal terms only)n- the number of weights (if using off-diagonal)rows- index list of rows forsigma_vcols- index list of columns forsigma_vvals- array of weights
Level: intermediate
See also: Tao, TaoSetResidualRoutine()
External Links
- PETSc Manual:
Tao/TaoSetResidualWeights
PETSc.LibPETSc.TaoSetSolution — Method
TaoSetSolution(petsclib::PetscLibType, tao::AbstractTao, x0::AbstractPetscVec)Sets the vector holding the initial guess for the solve
Logically Collective
Input Parameters:
tao- theTaocontextx0- the initial guess
Level: beginner
See also: Tao, TaoCreate(), TaoSolve(), TaoGetSolution()
External Links
- PETSc Manual:
Tao/TaoSetSolution
PETSc.LibPETSc.TaoSetStateDesignIS — Method
TaoSetStateDesignIS(petsclib::PetscLibType, tao::AbstractTao, s_is::AbstractIS, d_is::AbstractIS)Indicate to the Tao object which variables in the solution vector are state variables and which are design. Only applies to PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- TheTaocontexts_is- the index set corresponding to the state variablesd_is- the index set corresponding to the design variables
Level: intermediate
See also: Tao, TaoSetJacobianStateRoutine(), TaoSetJacobianDesignRoutine()
External Links
- PETSc Manual:
Tao/TaoSetStateDesignIS
PETSc.LibPETSc.TaoSetTolerances — Method
TaoSetTolerances(petsclib::PetscLibType, tao::AbstractTao, gatol::PetscReal, grtol::PetscReal, gttol::PetscReal)Sets parameters used in TaoSolve() convergence tests
Logically Collective
Input Parameters:
tao- theTaocontextgatol- stop if norm of gradient is less than thisgrtol- stop if relative norm of gradient is less than thisgttol- stop if norm of gradient is reduced by this factor
Options Database Keys:
-tao_gatol gatol- Sets gatol-tao_grtol grtol- Sets grtol-tao_gttol gttol- Sets gttol
Stopping Criteria: $||g(X)|| <= gatol ||g(X)|| / |f(X)| <= grtol ||g(X)|| / ||g(X0)|| <= gttol$
Level: beginner
See also: Tao, TaoConvergedReason, TaoGetTolerances()
External Links
- PETSc Manual:
Tao/TaoSetTolerances
PETSc.LibPETSc.TaoSetTotalIterationNumber — Method
TaoSetTotalIterationNumber(petsclib::PetscLibType, tao::AbstractTao, iter::PetscInt)Sets the current total iteration number.
Logically Collective
Input Parameters:
tao- theTaocontextiter- the iteration number
Level: developer
See also: Tao, TaoGetLinearSolveIterations()
External Links
- PETSc Manual:
Tao/TaoSetTotalIterationNumber
PETSc.LibPETSc.TaoSetType — Method
TaoSetType(petsclib::PetscLibType, tao::AbstractTao, type::String)Sets the TaoType for the minimization solver.
Collective
Input Parameters:
tao- theTaosolver contexttype- a known method
Options Database Key:
-tao_type type- Sets the method; seeTaoType
Level: intermediate
See also: Tao, TaoCreate(), TaoGetType(), TaoType
External Links
- PETSc Manual:
Tao/TaoSetType
PETSc.LibPETSc.TaoSetUp — Method
TaoSetUp(petsclib::PetscLibType, tao::AbstractTao)Sets up the internal data structures for the later use of a Tao solver
Collective
Input Parameter:
tao- theTaocontext
Level: advanced
See also: Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoSetUp
PETSc.LibPETSc.TaoSetUpdate — Method
TaoSetUpdate(petsclib::PetscLibType, tao::AbstractTao, func::external, ctx::Ptr{Cvoid})Sets the general-purpose update function called at the beginning of every iteration of the optimization algorithm. Called after the new solution and the gradient is determined, but before the Hessian is computed (if applicable).
Logically Collective
Input Parameters:
tao- TheTaosolverfunc- The functionctx- The update function context
Calling sequence of func:
tao- The optimizer contextit- The current iteration indexctx- The update context
Level: advanced
See also: Tao, TaoSolve()
External Links
- PETSc Manual:
Tao/TaoSetUpdate
PETSc.LibPETSc.TaoSetVariableBounds — Method
TaoSetVariableBounds(petsclib::PetscLibType, tao::AbstractTao, XL::AbstractPetscVec, XU::AbstractPetscVec)Sets the upper and lower bounds for the optimization problem
Logically Collective
Input Parameters:
tao- theTaocontextXL- vector of lower boundsXU- vector of upper bounds
Level: beginner
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetVariableBounds
PETSc.LibPETSc.TaoSetVariableBoundsRoutine — Method
TaoSetVariableBoundsRoutine(petsclib::PetscLibType, tao::AbstractTao, func::external, ctx::Ptr{Cvoid})Sets a function to be used to compute lower and upper variable bounds for the optimization
Logically Collective
Input Parameters:
tao- theTaocontextfunc- the bounds computation routinectx- [optional] user-defined context for private data for the bounds computation (may beNULL)
Calling sequence of func:
tao- theTaosolverxl- vector of lower boundsxu- vector of upper boundsctx- the (optional) user-defined function context
Level: beginner
See also: Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetVariableBoundsRoutine
PETSc.LibPETSc.TaoShellGetContext — Method
ctx::Ptr{Cvoid} = TaoShellGetContext(petsclib::PetscLibType, tao::AbstractTao)Returns the user-provided context associated with a TAOSHELL
Not Collective
Input Parameter:
tao- should have been created withTaoSetType(tao,TAOSHELL);
Output Parameter:
ctx- the user provided context
Level: advanced
See also: Tao, TAOSHELL, TaoShellSetContext()
External Links
- PETSc Manual:
Tao/TaoShellGetContext
PETSc.LibPETSc.TaoShellSetContext — Method
TaoShellSetContext(petsclib::PetscLibType, tao::AbstractTao, ctx::Ptr{Cvoid})sets the context for a TAOSHELL
Logically Collective
Input Parameters:
tao- the shell Taoctx- the context
Level: advanced
See also: Tao, TAOSHELL, TaoShellGetContext()
External Links
- PETSc Manual:
Tao/TaoShellSetContext
PETSc.LibPETSc.TaoShellSetSolve — Method
TaoShellSetSolve(petsclib::PetscLibType, tao::AbstractTao, solve::external)Sets routine to apply as solver
Logically Collective
Input Parameters:
tao- the nonlinear solver contextsolve- the application-provided solver routine
Calling sequence of solve:
tao- the optimizer, get the application context withTaoShellGetContext()
Level: advanced
See also: Tao, TAOSHELL, TaoShellSetContext(), TaoShellGetContext()
External Links
- PETSc Manual:
Tao/TaoShellSetSolve
PETSc.LibPETSc.TaoSoftThreshold — Method
TaoSoftThreshold(petsclib::PetscLibType, in::AbstractPetscVec, lb::PetscReal, ub::PetscReal, out::AbstractPetscVec)Calculates soft thresholding routine with input vector and given lower and upper bound and returns it to output vector.
Collective
Input Parameters:
in- input vector to be thresholdedlb- lower boundub- upper bound
Output Parameter:
out- Soft thresholded output vector
See also: Tao, Vec
External Links
- PETSc Manual:
Tao/TaoSoftThreshold
PETSc.LibPETSc.TaoSolve — Method
TaoSolve(petsclib::PetscLibType, tao::AbstractTao)Solves an optimization problem min F(x) s.t. l <= x <= u
Collective
Input Parameter:
tao- theTaocontext
Level: beginner
See also: Tao, TaoCreate(), TaoSetObjective(), TaoSetGradient(), TaoSetHessian(), TaoGetConvergedReason(), TaoSetUp()
External Links
- PETSc Manual:
Tao/TaoSolve
PETSc.LibPETSc.TaoTestGradient — Method
TaoTestGradient(petsclib::PetscLibType, tao::AbstractTao, x::AbstractPetscVec, g1::AbstractPetscVec)Compare the user-supplied gradient with a finite-difference approximation, when requested via the options database, and print the difference.
Collective
Input Parameters:
tao- theTaocontextx- the point at which to evaluate the gradientg1- the user-supplied gradient atx
Options Database Keys:
-tao_test_gradient- enable the comparison-tao_test_gradient_view- display the user-supplied gradient, the finite-difference gradient, and their difference
Level: intermediate
See also: Tao, TaoTestHessian(), TaoComputeGradient()
External Links
- PETSc Manual:
Tao/TaoTestGradient
PETSc.LibPETSc.TaoTestHessian — Method
TaoTestHessian(petsclib::PetscLibType, tao::AbstractTao)Compare the user-supplied Hessian with a finite-difference approximation, when requested via the options database, and print the difference.
Collective
Input Parameter:
tao- theTaocontext
Options Database Keys:
-tao_test_hessian threshold- enable the comparison, optionally overriding the reporting threshold (default1e-5)-tao_test_hessian_view- display the user-supplied Hessian, the finite-difference Hessian, and their difference
Level: intermediate
See also: Tao, TaoTestGradient(), TaoComputeHessian()
External Links
- PETSc Manual:
Tao/TaoTestHessian
PETSc.LibPETSc.TaoVecGetSubVec — Method
vreduced::PetscVec = TaoVecGetSubVec(petsclib::PetscLibType, vfull::AbstractPetscVec, is::AbstractIS, reduced_type::TaoSubsetType, maskvalue::PetscReal)Gets a subvector using the IS
Input Parameters:
vfull- the full matrixis- the index set for the subvectorreduced_type- the methodTaois using for subsettingmaskvalue- the value to set the unused vector elements to (forTAO_SUBSET_MASKorTAO_SUBSET_MATRIXFREE)
Output Parameter:
vreduced- the subvector
Level: developer
See also: TaoMatGetSubMat(), TaoSubsetType
External Links
- PETSc Manual:
Tao/TaoVecGetSubVec
PETSc.LibPETSc.TaoView — Method
TaoView(petsclib::PetscLibType, tao::AbstractTao, viewer::PetscViewer)Prints information about the Tao object
Collective
Input Parameters:
tao- theTaocontextviewer- visualization context
Options Database Key:
-tao_view- CallsTaoView()at the end ofTaoSolve()
Level: beginner
See also: Tao, PetscViewerASCIIOpen()
External Links
- PETSc Manual:
Tao/TaoView
PETSc.LibPETSc.TaoViewFromOptions — Method
TaoViewFromOptions(petsclib::PetscLibType, A::AbstractTao, obj, name::String)View a Tao object based on values in the options database
Collective
Input Parameters:
A- theTaocontextobj- Optional object that provides the prefix for the options databasename- command line option
Options Database Key:
-name [viewertype][:...]- option name and values. SeePetscObjectViewFromOptions()for the possible arguments
Level: intermediate
See also: Tao, TaoView, PetscObjectViewFromOptions(), TaoCreate()
External Links
- PETSc Manual:
Tao/TaoViewFromOptions
Tao Add-ons
Additional Tao utilities and helper functions:
PETSc.LibPETSc.TaoLineSearchAppendOptionsPrefix — Method
TaoLineSearchAppendOptionsPrefix(petsclib::PetscLibType, ls::TaoLineSearch, p::String)Appends to the prefix used for searching for all TaoLineSearch options in the database.
Collective
Input Parameters:
ls- theTaoLineSearchsolver contextp- the prefix string to prepend to all line search requests
Level: advanced
See also: Tao, TaoLineSearch, TaoLineSearchSetOptionsPrefix(), TaoLineSearchGetOptionsPrefix()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchAppendOptionsPrefix
PETSc.LibPETSc.TaoLineSearchApply — Method
f::PetscReal,steplength::PetscReal,reason::TaoLineSearchConvergedReason = TaoLineSearchApply(petsclib::PetscLibType, ls::TaoLineSearch, x::AbstractPetscVec, g::AbstractPetscVec, s::AbstractPetscVec)Performs a line-search in a given step direction. Criteria for acceptable step length depends on the line-search algorithm chosen
Collective
Input Parameters:
ls- theTaoLineSearchcontexts- search direction
Output Parameters:
x- On input the current solution, on outputxcontains the new solution determined by the line searchf- On input the objective function value at current solution, on output contains the objective function value at new solutiong- On input the gradient evaluated atx, on output contains the gradient at new solutionsteplength- scalar multiplier ofsused ( x = x_0 + steplength * x)reason-TaoLineSearchConvergedReasonreason why the line-search stopped
Level: advanced
See also: Tao, TaoLineSearchConvergedReason, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetType(), TaoLineSearchSetInitialStepLength(), TaoAddLineSearchCounts()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchApply
PETSc.LibPETSc.TaoLineSearchComputeGradient — Method
TaoLineSearchComputeGradient(petsclib::PetscLibType, ls::TaoLineSearch, x::AbstractPetscVec, g::AbstractPetscVec)Computes the gradient of the objective function
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameter:
g- gradient vector
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchComputeObjective(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetGradient()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchComputeGradient
PETSc.LibPETSc.TaoLineSearchComputeObjective — Method
f::PetscReal = TaoLineSearchComputeObjective(petsclib::PetscLibType, ls::TaoLineSearch, x::AbstractPetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameter:
f- Objective value atx
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetObjectiveRoutine()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchComputeObjective
PETSc.LibPETSc.TaoLineSearchComputeObjectiveAndGTS — Method
f::PetscReal,gts::PetscReal = TaoLineSearchComputeObjectiveAndGTS(petsclib::PetscLibType, ls::TaoLineSearch, x::AbstractPetscVec)Computes the objective function value and inner product of gradient and step direction at a given point
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameters:
f- Objective value atxgts- inner product of gradient and step direction atx
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetObjectiveRoutine()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchComputeObjectiveAndGTS
PETSc.LibPETSc.TaoLineSearchComputeObjectiveAndGradient — Method
f::PetscReal = TaoLineSearchComputeObjectiveAndGradient(petsclib::PetscLibType, ls::TaoLineSearch, x::AbstractPetscVec, g::AbstractPetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameters:
f- Objective value atxg- Gradient vector atx
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchSetObjectiveRoutine()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchComputeObjectiveAndGradient
PETSc.LibPETSc.TaoLineSearchCreate — Method
newls::TaoLineSearch = TaoLineSearchCreate(petsclib::PetscLibType, comm::MPI_Comm)Creates a TaoLineSearch object. Algorithms in Tao that use line-searches will automatically create one so this all is rarely needed
Collective
Input Parameter:
comm- MPI communicator
Output Parameter:
newls- the newTaoLineSearchcontext
Options Database Key:
-tao_ls_type (unit|more-thuente|gpcg|armijo|owarmijo|ipm)- select which line searchTaoshould use
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchType, TaoLineSearchSetType(), TaoLineSearchApply(), TaoLineSearchDestroy()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchCreate
PETSc.LibPETSc.TaoLineSearchDestroy — Method
TaoLineSearchDestroy(petsclib::PetscLibType, ls::Union{TaoLineSearch, Ref{TaoLineSearch}})Destroys the TaoLineSearch context that was created with TaoLineSearchCreate()
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Level: developer
See also: TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchApple()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchDestroy
PETSc.LibPETSc.TaoLineSearchFinalizePackage — Method
TaoLineSearchFinalizePackage(petsclib::PetscLibType)This function destroys everything in the TaoLineSearch package. It is called from PetscFinalize().
Level: developer
See also: Tao, TaoLineSearch
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchFinalizePackage
PETSc.LibPETSc.TaoLineSearchGetFullStepObjective — Method
f_fullstep::PetscReal = TaoLineSearchGetFullStepObjective(petsclib::PetscLibType, ls::TaoLineSearch)Returns the objective function value at the full step. Useful for some minimization algorithms.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
f_fullstep- the objective value at the full step length
Level: developer
See also: TaoLineSearchGetSolution(), TaoLineSearchGetStartingVector(), TaoLineSearchGetStepDirection()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetFullStepObjective
PETSc.LibPETSc.TaoLineSearchGetNumberFunctionEvaluations — Method
nfeval::PetscInt,ngeval::PetscInt,nfgeval::PetscInt = TaoLineSearchGetNumberFunctionEvaluations(petsclib::PetscLibType, ls::TaoLineSearch)Gets the number of function and gradient evaluation routines used by the line search in last application (not cumulative).
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameters:
nfeval- number of function evaluationsngeval- number of gradient evaluationsnfgeval- number of function/gradient evaluations
Level: intermediate
See also: TaoLineSearch
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetNumberFunctionEvaluations
PETSc.LibPETSc.TaoLineSearchGetOptionsPrefix — Method
p::String = TaoLineSearchGetOptionsPrefix(petsclib::PetscLibType, ls::TaoLineSearch)Gets the prefix used for searching for all TaoLineSearch options in the database
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
p- pointer to the prefix string used is returned
Level: advanced
See also: Tao, TaoLineSearch, TaoLineSearchSetOptionsPrefix(), TaoLineSearchAppendOptionsPrefix()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetOptionsPrefix
PETSc.LibPETSc.TaoLineSearchGetSolution — Method
f::PetscReal,steplength::PetscReal,reason::TaoLineSearchConvergedReason = TaoLineSearchGetSolution(petsclib::PetscLibType, ls::TaoLineSearch, x::AbstractPetscVec, g::AbstractPetscVec)Returns the solution to the line search
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameters:
x- the new solutionf- the objective function value atxg- the gradient atxsteplength- the multiple of the step direction taken by the line searchreason- the reason why the line search terminated
Level: developer
See also: TaoLineSearchGetStartingVector(), TaoLineSearchGetStepDirection()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetSolution
PETSc.LibPETSc.TaoLineSearchGetStartingVector — Method
x::PetscVec = TaoLineSearchGetStartingVector(petsclib::PetscLibType, ls::TaoLineSearch)Gets a the initial point of the line search.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
x- The initial point of the line search
Level: advanced
See also: TaoLineSearchGetSolution(), TaoLineSearchGetStepDirection()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetStartingVector
PETSc.LibPETSc.TaoLineSearchGetStepDirection — Method
s::PetscVec = TaoLineSearchGetStepDirection(petsclib::PetscLibType, ls::TaoLineSearch)Gets the step direction of the line search.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
s- the step direction of the line search
Level: advanced
See also: TaoLineSearchGetSolution(), TaoLineSearchGetStartingVector()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetStepDirection
PETSc.LibPETSc.TaoLineSearchGetStepLength — Method
s::PetscReal = TaoLineSearchGetStepLength(petsclib::PetscLibType, ls::TaoLineSearch)Get the current step length
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
s- the current step length
Level: intermediate
See also: Tao, TaoLineSearch, TaoLineSearchSetInitialStepLength(), TaoLineSearchApply()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetStepLength
PETSc.LibPETSc.TaoLineSearchGetType — Method
type::String = TaoLineSearchGetType(petsclib::PetscLibType, ls::TaoLineSearch)Gets the current line search algorithm
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
type- the line search algorithm in effect
Level: developer
See also: TaoLineSearch, TaoLineSearchSetType(), TaoLineSearchType, PetscObjectTypeCompare(), PetscObjectTypeCompareAny()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchGetType
PETSc.LibPETSc.TaoLineSearchInitializePackage — Method
TaoLineSearchInitializePackage(petsclib::PetscLibType)This function registers the line-search algorithms in Tao. When using shared or static libraries, this function is called from the first entry to TaoCreate(); when using dynamic, it is called from PetscDLLibraryRegister_tao()
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchCreate()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchInitializePackage
PETSc.LibPETSc.TaoLineSearchIsUsingTaoRoutines — Method
flg::PetscBool = TaoLineSearchIsUsingTaoRoutines(petsclib::PetscLibType, ls::TaoLineSearch)Checks whether the line search is using the standard Tao evaluation routines.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
flg-PETSC_TRUEif the line search is usingTaoevaluation routines,
otherwise PETSC_FALSE
Level: developer
See also: TaoLineSearch
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchIsUsingTaoRoutines
PETSc.LibPETSc.TaoLineSearchMonitor — Method
TaoLineSearchMonitor(petsclib::PetscLibType, ls::TaoLineSearch, its::PetscInt, f::PetscReal, step::PetscReal)Monitor the line search steps. This routine will output the iteration number, step length, and function value before calling the implementation specific monitor.
Input Parameters:
ls- theTaoLineSearchcontextits- the current iterate number (>=0)f- the current objective function valuestep- the step length
Options Database Key:
-tao_ls_monitor- Use the default monitor, which prints statistics to standard output
Level: developer
See also: TaoLineSearch
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchMonitor
PETSc.LibPETSc.TaoLineSearchRegister — Method
TaoLineSearchRegister(petsclib::PetscLibType, sname::String, func::external)Adds a line-search algorithm to the registry
Not Collective, No Fortran Support
Input Parameters:
sname- name of a new user-defined solverfunc- routine to Create method context
Calling sequence of func:
ls- theTaoLineSearchobject to set with theTaoLineSearchTypespecific structure
See also: Tao, TaoLineSearch
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchRegister
PETSc.LibPETSc.TaoLineSearchReset — Method
TaoLineSearchReset(petsclib::PetscLibType, ls::TaoLineSearch)Some line searches may carry state information from one TaoLineSearchApply() to the next. This function resets this state information.
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchApply()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchReset
PETSc.LibPETSc.TaoLineSearchSetFromOptions — Method
TaoLineSearchSetFromOptions(petsclib::PetscLibType, ls::TaoLineSearch)Sets various TaoLineSearch parameters from user options.
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Options Database Keys:
-tao_ls_type (unit|more-thuente|gpcg|armijo|owarmijo|ipm)- select which line searchTaoshould use-tao_ls_ftol tol- tolerance for sufficient decrease-tao_ls_gtol tol- tolerance for curvature condition-tao_ls_rtol tol- relative tolerance for acceptable step-tao_ls_stepinit step- initial steplength allowed-tao_ls_stepmin step- minimum steplength allowed-tao_ls_stepmax step- maximum steplength allowed-tao_ls_max_funcs n- maximum number of function evaluations allowed-tao_ls_view- display line-search results
Level: beginner
See also: Tao, TaoLineSearch, TaoGetLineSearch()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetFromOptions
PETSc.LibPETSc.TaoLineSearchSetGradientRoutine — Method
TaoLineSearchSetGradientRoutine(petsclib::PetscLibType, ls::TaoLineSearch, func::external, ctx::Ptr{Cvoid})Sets the gradient evaluation routine for the line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the gradient evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the linesearch objectx- input vectorg- gradient vectorctx- (optional) user-defined context
Level: beginner
See also: Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjectiveRoutine(), TaoLineSearchSetObjectiveAndGradientRoutine(), TaoLineSearchUseTaoRoutines()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetGradientRoutine
PETSc.LibPETSc.TaoLineSearchSetInitialStepLength — Method
TaoLineSearchSetInitialStepLength(petsclib::PetscLibType, ls::TaoLineSearch, s::PetscReal)Sets the initial step length of a line search. If this value is not set then 1.0 is assumed.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontexts- the initial step size
Level: intermediate
See also: Tao, TaoLineSearch, TaoLineSearchGetStepLength(), TaoLineSearchApply()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetInitialStepLength
PETSc.LibPETSc.TaoLineSearchSetObjectiveAndGTSRoutine — Method
TaoLineSearchSetObjectiveAndGTSRoutine(petsclib::PetscLibType, ls::TaoLineSearch, func::external, ctx::Ptr{Cvoid})Sets the objective and (gradient'*stepdirection) evaluation routine for the line search.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the objective and gradient evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the linesearch contextx- input vectors- step directionf- function valuegts- inner product of gradient and step direction vectorsctx- (optional) user-defined context
Level: advanced
See also: Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjective(), TaoLineSearchSetGradient(), TaoLineSearchUseTaoRoutines()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetObjectiveAndGTSRoutine
PETSc.LibPETSc.TaoLineSearchSetObjectiveAndGradientRoutine — Method
TaoLineSearchSetObjectiveAndGradientRoutine(petsclib::PetscLibType, ls::TaoLineSearch, func::external, ctx::Ptr{Cvoid})Sets the objective/gradient evaluation routine for the line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the objective and gradient evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the linesearch objectx- input vectorf- function valueg- gradient vectorctx- (optional) user-defined context
Level: beginner
See also: Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjectiveRoutine(), TaoLineSearchSetGradientRoutine(), TaoLineSearchUseTaoRoutines()
External Links
PETSc.LibPETSc.TaoLineSearchSetObjectiveRoutine — Method
TaoLineSearchSetObjectiveRoutine(petsclib::PetscLibType, ls::TaoLineSearch, func::external, ctx::Ptr{Cvoid})Sets the function evaluation routine for the line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the objective function evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the line search contextx- input vectorf- function valuectx- (optional) user-defined context
Level: advanced
See also: Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetGradientRoutine(), TaoLineSearchSetObjectiveAndGradientRoutine(), TaoLineSearchUseTaoRoutines()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetObjectiveRoutine
PETSc.LibPETSc.TaoLineSearchSetOptionsPrefix — Method
TaoLineSearchSetOptionsPrefix(petsclib::PetscLibType, ls::TaoLineSearch, p::String)Sets the prefix used for searching for all TaoLineSearch options in the database.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextp- the prefix string to prepend to alllsoption requests
Level: advanced
See also: Tao, TaoLineSearch, TaoLineSearchAppendOptionsPrefix(), TaoLineSearchGetOptionsPrefix()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetOptionsPrefix
PETSc.LibPETSc.TaoLineSearchSetType — Method
TaoLineSearchSetType(petsclib::PetscLibType, ls::TaoLineSearch, type::String)Sets the algorithm used in a line search
Collective
Input Parameters:
ls- theTaoLineSearchcontexttype- theTaoLineSearchTypeselection
Options Database Key:
-tao_ls_type (unit|more-thuente|gpcg|armijo|owarmijo|ipm)- select which line searchTaoshould use
Level: beginner
See also: Tao, TaoLineSearch, TaoLineSearchType, TaoLineSearchCreate(), TaoLineSearchGetType(), TaoLineSearchApply()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetType
PETSc.LibPETSc.TaoLineSearchSetUp — Method
TaoLineSearchSetUp(petsclib::PetscLibType, ls::TaoLineSearch)Sets up the internal data structures for the later use of a TaoLineSearch
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchApply()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetUp
PETSc.LibPETSc.TaoLineSearchSetVariableBounds — Method
TaoLineSearchSetVariableBounds(petsclib::PetscLibType, ls::TaoLineSearch, xl::AbstractPetscVec, xu::AbstractPetscVec)Sets the upper and lower bounds for a bounded line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextxl- vector of lower boundsxu- vector of upper bounds
Level: beginner
See also: Tao, TaoLineSearch, TaoSetVariableBounds(), TaoLineSearchCreate()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchSetVariableBounds
PETSc.LibPETSc.TaoLineSearchUseTaoRoutines — Method
TaoLineSearchUseTaoRoutines(petsclib::PetscLibType, ls::TaoLineSearch, ts::AbstractTao)Informs the TaoLineSearch to use the objective and gradient evaluation routines from the given Tao object. The default.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextts- theTaocontext with defined objective/gradient evaluation routines
Level: developer
See also: Tao, TaoLineSearch, TaoLineSearchCreate()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchUseTaoRoutines
PETSc.LibPETSc.TaoLineSearchView — Method
TaoLineSearchView(petsclib::PetscLibType, ls::TaoLineSearch, viewer::PetscViewer)Prints information about the TaoLineSearch
Collective
Input Parameters:
ls- theTaoLineSearchcontextviewer- visualization context
Options Database Key:
-tao_ls_view- CallsTaoLineSearchView()at the end of each line search
Level: beginner
See also: Tao, TaoLineSearch, PetscViewerASCIIOpen(), TaoLineSearchViewFromOptions()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchView
PETSc.LibPETSc.TaoLineSearchViewFromOptions — Method
TaoLineSearchViewFromOptions(petsclib::PetscLibType, A::TaoLineSearch, obj, name::String)View a TaoLineSearch object based on values in the options database
Collective
Input Parameters:
A- theTaocontextobj- Optional objectname- command line option
Options Database Key:
-name [viewertype][:...]- option name and values. SeePetscObjectViewFromOptions()for the possible arguments
Level: intermediate
See also: Tao, TaoLineSearch, TaoLineSearchView(), PetscObjectViewFromOptions(), TaoLineSearchCreate()
External Links
- PETSc Manual:
TaoLineSearch/TaoLineSearchViewFromOptions
PETSc.LibPETSc.TaoMonitorDrawCtxCreate — Method
ctx::TaoMonitorDrawCtx = TaoMonitorDrawCtxCreate(petsclib::PetscLibType, comm::MPI_Comm, host::String, label::String, x::Cint, y::Cint, m::Cint, n::Cint, howoften::PetscInt)Creates the monitor context for TaoMonitorSolutionDraw()
Collective
Input Parameters:
comm- the communicator to share the contexthost- the name of the X Windows host that will display the monitorlabel- the label to put at the top of the display windowx- the horizontal coordinate of the lower left corner of the window to openy- the vertical coordinate of the lower left corner of the window to openm- the width of the windown- the height of the windowhowoften- how manyTaoiterations between displaying the monitor information
Output Parameter:
ctx- the monitor context
Options Database Keys:
-tao_monitor_solution_draw- useTaoMonitorSolutionDraw()to monitor the solution-tao_draw_solution_initial- show initial guess as well as current solution
Level: intermediate
See also: Tao, TaoMonitorSet(), TaoMonitorDefault(), VecView(), TaoMonitorDrawCtx()
External Links
- PETSc Manual:
Tao/TaoMonitorDrawCtxCreate
PETSc.LibPETSc.TaoMonitorDrawCtxDestroy — Method
TaoMonitorDrawCtxDestroy(petsclib::PetscLibType, ictx::Union{TaoMonitorDrawCtx, Ref{TaoMonitorDrawCtx}})Destroys the monitor context for TaoMonitorSolutionDraw()
Collective
Input Parameter:
ictx- the monitor context
Level: intermediate
See also: Tao, TaoMonitorSet(), TaoMonitorDefault(), VecView(), TaoMonitorSolutionDraw()
External Links
- PETSc Manual:
Tao/TaoMonitorDrawCtxDestroy
PETSc.LibPETSc.TaoTermComputeGradient — Method
TaoTermComputeGradient(petsclib::PetscLibType, term::TaoTerm, x::AbstractPetscVec, params::AbstractPetscVec, g::AbstractPetscVec)Evaluate the gradient of a TaoTerm for a given solution vector and parameter vector
Collective
Input Parameters:
term- aTaoTermrepresenting a parametric function f(x; p)x- the solution variable x in f(x; p)params- the parameters p in f(x; p) (may be NULL if the term is not parametric)
Output Parameter:
g- the value of \nabla_x f(x; p)
Level: developer
TaoTerm, TaoTermComputeObjective(), TaoTermComputeObjectiveAndGradient(), TaoTermComputeHessian(), TaoTermShellSetGradient()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeGradient
PETSc.LibPETSc.TaoTermComputeGradientFD — Method
TaoTermComputeGradientFD(petsclib::PetscLibType, term::TaoTerm, x::AbstractPetscVec, params::AbstractPetscVec, g::AbstractPetscVec)Approximate the gradient of a TaoTerm using finite differences
Collective
Input Parameters:
term- aTaoTermx- a solution vectorparams- parameters vector (may beNULL, seeTaoTermParametersMode)
Output Parameter:
g- the computed finite difference approximation to the gradient
Options Database Keys:
-tao_term_fd_delta <delta>- change inxused to calculate finite differences-tao_term_gradient_use_fd <bool>- UseTaoTermComputeGradientFD()inTaoTermComputeGradient()
Level: advanced
Notes: This routine is slow and expensive, and is not optimized to take advantage of sparsity in the problem. Although not recommended for general use in large-scale applications, it can be useful in checking the correctness of a user-provided gradient. Call TaoTermComputeGradientSetUseFD() to start using this routine in TaoTermComputeGradient().
TaoTerm, TaoTermGetFDDelta(), TaoTermSetFDDelta(), TaoTermComputeGradientSetUseFD(), TaoTermComputeGradientGetUseFD(), TaoTermComputeHessianFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeGradientFD
PETSc.LibPETSc.TaoTermComputeGradientGetUseFD — Method
use_fd::PetscBool = TaoTermComputeGradientGetUseFD(petsclib::PetscLibType, term::TaoTerm)Get whether finite differences are used in TaoTermComputeGradient().
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
use_fd-PETSC_TRUEif finite differences are used
Level: advanced
TaoTerm, TaoTermGetFDDelta(), TaoTermSetFDDelta(), TaoTermComputeGradientFD(), TaoTermComputeGradientSetUseFD(), TaoTermComputeHessianFD(), TaoTermComputeHessianSetUseFD(), TaoTermComputeHessianGetUseFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeGradientGetUseFD
PETSc.LibPETSc.TaoTermComputeGradientSetUseFD — Method
TaoTermComputeGradientSetUseFD(petsclib::PetscLibType, term::TaoTerm, use_fd::PetscBool)Set whether to use finite differences instead of the user-provided or built-in gradient method in TaoTermComputeGradient().
Logically collective
Input Parameters:
term- aTaoTermuse_fd-PETSC_TRUEto use finite differences,PETSC_FALSEto use the user-provided or built-in gradient method
Options Database Keys:
-tao_term_gradient_use_fd <bool>- use finite differences for gradient computation
Level: advanced
TaoTerm, TaoTermGetFDDelta(), TaoTermSetFDDelta(), TaoTermComputeGradientFD(), TaoTermComputeGradientGetUseFD(), TaoTermComputeHessianFD(), TaoTermComputeHessianSetUseFD(), TaoTermComputeHessianGetUseFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeGradientSetUseFD
PETSc.LibPETSc.TaoTermComputeHessian — Method
TaoTermComputeHessian(petsclib::PetscLibType, term::TaoTerm, x::AbstractPetscVec, params::AbstractPetscVec, H::AbstractPetscMat, Hpre::AbstractPetscMat)Evaluate the Hessian of a TaoTerm (with respect to the solution variables) for a given solution vector and parameter vector
Collective
Input Parameters:
term- aTaoTermrepresenting a parametric function f(x; p)x- the solution variable x in f(x; p)params- the parameters p in f(x; p) (may beNULLif the term is not parametric)
Output Parameters:
H- Hessian matrix \nabla_x^2 f(x;p)Hpre- an (approximate) Hessian from which the preconditioner will be constructed, often the same asH
Level: developer
Note: If there is no separate matrix from which to construct the preconditioner, then TaoTermComputeHessian(term, x, params, H, NULL) and TaoTermComputeHessian(term, x, params, H, H) are equivalent.
TaoTerm, TaoTermComputeObjective(), TaoTermComputeGradient(), TaoTermComputeObjectiveAndGradient(), TaoTermShellSetHessian()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeHessian
PETSc.LibPETSc.TaoTermComputeHessianFD — Method
TaoTermComputeHessianFD(petsclib::PetscLibType, term::TaoTerm, x::AbstractPetscVec, params::AbstractPetscVec, H::AbstractPetscMat, Hpre::AbstractPetscMat)Use finite difference to compute Hessian matrix.
Collective
Input Parameters:
term- aTaoTermx- a solution vectorparams- parameters vector (may beNULL, seeTaoTermParametersMode)
Output Parameters:
H- (optional) Hessian matrixHpre- (optional) Hessian preconditioning matrix
Options Database Keys:
-tao_term_fd_delta <delta>- change in X used to calculate finite differences-tao_term_hessian_use_fd <bool>- UseTaoTermComputeHessianFD()inTaoTermComputeHessian()
Level: advanced
Notes: This routine is slow and expensive, and is not optimized to take advantage of sparsity in the problem. Although not recommended for general use in large-scale applications, it can be useful in checking the correctness of a user-provided Hessian. Call TaoTermComputeHessianSetUseFD() to start using this routine in TaoTermComputeHessian().
TaoTerm, TaoTermComputeHessian(), TaoTermGetFDDelta(), TaoTermSetFDDelta(), TaoTermComputeHessianSetUseFD(), TaoTermComputeHessianGetUseFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeHessianFD
PETSc.LibPETSc.TaoTermComputeHessianGetUseFD — Method
use_fd::PetscBool = TaoTermComputeHessianGetUseFD(petsclib::PetscLibType, term::TaoTerm)Get whether finite differences are used in TaoTermComputeHessian().
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
use_fd-PETSC_TRUEif finite differences are used
Level: advanced
TaoTerm, TaoTermGetFDDelta(), TaoTermSetFDDelta(), TaoTermComputeGradientFD(), TaoTermComputeGradientSetUseFD(), TaoTermComputeGradientGetUseFD(), TaoTermComputeHessianFD(), TaoTermComputeHessianSetUseFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeHessianGetUseFD
PETSc.LibPETSc.TaoTermComputeHessianMFFD — Method
TaoTermComputeHessianMFFD(petsclib::PetscLibType, term::TaoTerm, x::AbstractPetscVec, params::AbstractPetscVec, H::AbstractPetscMat, B::AbstractPetscMat)Update a matrix-free finite-difference MATMFFD Hessian created by TaoTermCreateHessianMFFD() to represent the Hessian of a TaoTerm at a given point and parameters.
Collective
Input Parameters:
term- theTaoTermx- the point at which the Hessian is to be appliedparams- the current parameter vector forterm, orNULL
Output Parameters:
H- theMATMFFDHessian, reinitialized if needed and updated to base pointxB- the preconditioning matrix (unused; retained for API symmetry), orNULL
Level: advanced
See also: TaoTerm, TaoTermCreateHessianMFFD(), TaoTermComputeHessian(), MATMFFD
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeHessianMFFD
PETSc.LibPETSc.TaoTermComputeHessianSetUseFD — Method
TaoTermComputeHessianSetUseFD(petsclib::PetscLibType, term::TaoTerm, use_fd::PetscBool)Set whether to use finite differences instead of the user-provided or built-in methods in TaoTermComputeHessian().
Logically collective
Input Parameters:
term- aTaoTermuse_fd-PETSC_TRUEto use finite differences,PETSC_FALSEto use the user-provided or built-in Hessian method
Options Database Keys:
-tao_term_hessian_use_fd <bool>- use finite differences for Hessian computation
Level: advanced
TaoTerm, TaoTermGetFDDelta(), TaoTermSetFDDelta(), TaoTermComputeGradientFD(), TaoTermComputeGradientSetUseFD(), TaoTermComputeGradientGetUseFD(), TaoTermComputeHessianFD(), TaoTermComputeHessianGetUseFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeHessianSetUseFD
PETSc.LibPETSc.TaoTermComputeObjective — Method
value::PetscReal = TaoTermComputeObjective(petsclib::PetscLibType, term::TaoTerm, x::AbstractPetscVec, params::AbstractPetscVec)Evaluate a TaoTerm for a given solution vector and parameter vector
Collective
Input Parameters:
term- aTaoTermrepresenting a parametric function f(x; p)x- the solution variable x in f(x; p)params- the parameters p in f(x; p) (may beNULLif the term is not parametric)
Output Parameter:
value- the value of f(x; p)
Level: developer
TaoTerm, TaoTermComputeGradient(), TaoTermComputeObjectiveAndGradient(), TaoTermComputeHessian(), TaoTermShellSetObjective()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeObjective
PETSc.LibPETSc.TaoTermComputeObjectiveAndGradient — Method
value::PetscReal = TaoTermComputeObjectiveAndGradient(petsclib::PetscLibType, term::TaoTerm, x::AbstractPetscVec, params::AbstractPetscVec, g::AbstractPetscVec)Evaluate both the value and gradient of a TaoTerm for a given set of solution vector and parameter vector
Collective
Input Parameters:
term- aTaoTermrepresenting a parametric function f(x; p)x- the solution variable x in f(x; p)params- the parameters p in f(x; p) (may be NULL if the term is not parametric)
Output Parameters:
value- the value of f(x; p)g- the value of \nabla_x f(x; p)
Level: developer
TaoTerm, TaoTermComputeObjective(), TaoTermComputeGradient(), TaoTermComputeHessian(), TaoTermShellSetObjectiveAndGradient()
External Links
- PETSc Manual:
TaoTerm/TaoTermComputeObjectiveAndGradient
PETSc.LibPETSc.TaoTermCreate — Method
term::TaoTerm = TaoTermCreate(petsclib::PetscLibType, comm::MPI_Comm)Create a TaoTerm to use in defining the function Tao is to optimize
Collective
Input Parameter:
comm- communicator for MPI processes that compute the term
Output Parameter:
term- a newTaoTerm
Level: beginner
TaoTerm, TaoTermSetType(), TaoAddTerm(), TaoTermSetFromOptions(), TaoTermSetUp(), TaoTermView(), TaoTermDestroy()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreate
PETSc.LibPETSc.TaoTermCreateHalfL2Squared — Method
term::TaoTerm = TaoTermCreateHalfL2Squared(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)Create a TaoTerm for the objective term \tfrac{1}{2}\|x - p\|_2^2, for solution x and parameters p.
Collective
Input Parameters:
comm- the MPI communicator where theTaoTermwill be computedn- the local size of the x and p vectors (orPETSC_DECIDE)N- the global size of the x and p vectors (orPETSC_DECIDE)
Output Parameter:
term- theTaoTerm
Level: beginner
Note: If you would like to add a Tikhonov regularization term \alpha \tfrac{1}{2}\|x\|2^2 to the objective function of a Tao, do the following: `` VecGetSizes(x, &n, &N); TaoTermCreateHalfL2Squared(PetscObjectComm((PetscObject)x), n, N, &term); TaoAddTerm(tao, "reg", alpha, term, NULL, NULL); TaoTermDestroy(&term); $If you would like to add a biased regularization term \alpha \tfrac{1}{2}\|x - p \|_2^2, do the same but pass `p` as the parameters of the term:$ TaoAddTerm(tao, "reg_", alpha, term, p, NULL); ``
TaoTerm, TAOTERMHALFL2SQUARED, TaoTermCreateL1(), TaoTermCreateQuadratic()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateHalfL2Squared
PETSc.LibPETSc.TaoTermCreateHessianMFFD — Method
mffd::PetscMat = TaoTermCreateHessianMFFD(petsclib::PetscLibType, term::TaoTerm)Create a MATMFFD for a matrix-free finite-difference approximation of the Hessian of a TaoTerm
Collective
Input Parameter:
term- aTaoTerm
Output Parameter:
mffd- aMatof typeMATMFFD
Level: advanced
See also: TaoTerm, TaoTermComputeHessianFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateHessianMFFD
PETSc.LibPETSc.TaoTermCreateHessianMatrices — Method
H::PetscMat,Hpre::PetscMat = TaoTermCreateHessianMatrices(petsclib::PetscLibType, term::TaoTerm)Create the matrices that can be inputs to TaoTermComputeHessian()
Collective
Input Parameter:
term- aTaoTerm
Output Parameters:
H- (optional) a matrix that can store the Hessian computed inTaoTermComputeHessian()Hpre- (optional) a matrix from which a preconditioner can be computed inTaoTermComputeHessian()
Level: advanced
Note: Before Hessian matrices can be created, the size of the solution vector space must be set (see the ways this can be done in TaoTermCreateSolutionVec()). If the term is a TAOTERMSHELL, TaoTermShellSetCreateHessianMatrices() must be called. Most TaoTerms use TaoTermCreateHessianMatricesDefault() to create their Hessian matrices: the behavior of that function can be controlled by TaoTermSetCreateHessianMode().
TaoTerm, TaoTermComputeHessian(), TaoTermShellSetCreateHessianMatrices(), TaoTermCreateSolutionVec(), TaoTermCreateHessianMatricesDefault(), TaoTermGetCreateHessianMode(), TaoTermSetCreateHessianMode(), TaoTermIsCreateHessianMatricesDefined()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateHessianMatrices
PETSc.LibPETSc.TaoTermCreateHessianMatricesDefault — Method
H::PetscMat,Hpre::PetscMat = TaoTermCreateHessianMatricesDefault(petsclib::PetscLibType, term::TaoTerm)Default routine for creating Hessian matrices that can be used by many TaoTerm implementations
Collective
Input Parameter:
term- aTaoTerm
Output Parameters:
H- (optional) a matrix that can store the Hessian computed inTaoTermComputeHessian()Hpre- (optional) a matrix from which a preconditioner can be computed inTaoTermComputeHessian()
Level: developer
Developer Note: The behavior of this routine is determined by TaoTermSetCreateHessianMode(). If Hpre_is_H, then the same matrix will be returned for H and Hpre, otherwise they will be separate matrices, with the matrix types H_mattype and Hpre_mattype. If either type is MATMFFD, then it will create a shell matrix with TaoTermCreateHessianMFFD().
TaoTerm, TaoTermComputeHessian(), TaoTermCreateHessianMatrices(), TaoTermGetCreateHessianMode(), TaoTermSetCreateHessianMode()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateHessianMatricesDefault
PETSc.LibPETSc.TaoTermCreateL1 — Method
term::TaoTerm = TaoTermCreateL1(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt, epsilon::PetscReal)Create a TaoTerm for the objective function term \|x - p\|_1.
Collective
Input Parameters:
comm- the MPI communicator where the term will be computedn- the local size of the x and p vectors (orPETSC_DECIDE)N- the global size of the x and p vectors (orPETSC_DECIDE)epsilon- a non-negative smoothing parameter (seeTaoTermL1SetEpsilon())
Output Parameter:
term- theTaoTerm
Level: beginner
Note: If you would like to add an L1 regularization term \alpha \|x\|1 to the objective function of a Tao, do the following: `` VecGetLocalSize(x, &n); VecGetSize(x, &N); TaoTermCreateL1(PetscObjectComm((PetscObject)x), n, N, 0.0, &term); TaoAddTerm(tao, "reg", alpha, term, NULL, NULL); TaoTermDestroy(&term); $If you would like to have a dictionary matrix term \alpha \|D x\|_1, do the same but pass `D` as the map of the term:$ MatGetLocalSize(D, &m, NULL); MatGetSize(D, &M, NULL); TaoTermCreateL1(PetscObjectComm((PetscObject)D), m, M, 0.0, &term); TaoAddTerm(tao, "reg_", alpha, term, NULL, D); TaoTermDestroy(&term); ``
TaoTerm, TAOTERML1, TaoTermL1GetEpsilon(), TaoTermL1SetEpsilon(), TaoTermCreateHalfL2Squared(), TaoTermCreateQuadratic()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateL1
PETSc.LibPETSc.TaoTermCreateParametersVec — Method
parameters::PetscVec = TaoTermCreateParametersVec(petsclib::PetscLibType, term::TaoTerm)Create a parameter vector for a TaoTerm
Collective
Input Parameter:
term- aTaoTerm
Output Parameter:
parameters- a compatible parameter vector forterm
Level: advanced
Notes: Before a TaoTerm can create a parameter vector, you must do one of the following:
- Call
TaoTermSetParametersSizes()to describe the size and parallel layout of a parameters vector. - Call
TaoTermSetParametersLayout()to directly setPetscLayouts for the parameters vector. - Call
TaoTermSetParametersTemplate()to set the parameters vector spaces to match existingVec. - If the
TaoTermis aTAOTERMSHELL, you can callTaoTermShellSetCreateParametersVec()to use your
own code for creating vectors.
You can also call TaoTermSetParametersVecType() to set the type of vector created (e.g. VECCUDA).
TaoTerm, TaoTermShellSetCreateParametersVec(), TaoTermGetParametersSizes(), TaoTermSetParametersSizes(), TaoTermSetParametersTemplate(), TaoTermGetParametersVecType(), TaoTermSetParametersVecType(), TaoTermGetParametersLayout(), TaoTermSetParametersLayout(), TaoTermCreateHessianMatrices()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateParametersVec
PETSc.LibPETSc.TaoTermCreateQuadratic — Method
term::TaoTerm = TaoTermCreateQuadratic(petsclib::PetscLibType, A::AbstractPetscMat)Create a TAOTERMQUADRATIC for a given matrix
Collective
Input Parameter:
A- a square matrix
Output Parameter:
term- aTaoTermthat implements \tfrac{1}{2}(x - p)^T A (x - p)
Level: beginner
TaoTerm, TaoTermCreate(), TAOTERMQUADRATIC, TaoTermCreateHalfL2Squared(), TaoTermCreateL1(), TaoTermQuadraticSetMat()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateQuadratic
PETSc.LibPETSc.TaoTermCreateShell — Method
term::TaoTerm = TaoTermCreateShell(petsclib::PetscLibType, comm::MPI_Comm, ctx::Ptr{Cvoid}, destroy::Ptr{Cvoid})Create a TaoTerm of type TAOTERMSHELL that is ready to accept user-provided callback operations.
Collective
Input Parameters:
comm- the MPI communicator for computing the termctx- (optional) a context to be used by routinesdestroy- (optional) a routine to destroy the context whentermis destroyed
Output Parameter:
term- aTaoTermof typeTAOTERMSHELL
Level: intermediate
See also: TaoTerm, TAOTERMSHELL
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateShell
PETSc.LibPETSc.TaoTermCreateSolutionVec — Method
solution::PetscVec = TaoTermCreateSolutionVec(petsclib::PetscLibType, term::TaoTerm)Create a solution vector for a TaoTerm
Collective
Input Parameter:
term- aTaoTerm
Output Parameter:
solution- a compatible solution vector forterm
Level: advanced
Note: Before a TaoTerm can create a solution vector, you must do one of the following:
- Call
TaoTermSetSolutionSizes()to describe the size and parallel layout of a solution vector. - Call
TaoTermSetSolutionLayout()to directly setPetscLayouts for the solution vector. - Call
TaoTermSetSolutionTemplate()to set the solution vector spaces to match existingVec. - If the
TaoTermis aTAOTERMSHELL, you can callTaoTermShellSetCreateSolutionVec()to use
your own code for creating vectors.
You can also call TaoTermSetSolutionVecType() to set the type of vector created (e.g. VECCUDA).
TaoTerm, TaoTermShellSetCreateSolutionVec(), TaoTermGetSolutionSizes(), TaoTermSetSolutionSizes(), TaoTermSetSolutionTemplate(), TaoTermGetSolutionVecType(), TaoTermSetSolutionVecType(), TaoTermGetSolutionLayout(), TaoTermSetSolutionLayout(), TaoTermCreateHessianMatrices()
External Links
- PETSc Manual:
TaoTerm/TaoTermCreateSolutionVec
PETSc.LibPETSc.TaoTermDestroy — Method
TaoTermDestroy(petsclib::PetscLibType, term::Union{TaoTerm, Ref{TaoTerm}})Destroy a TaoTerm.
Collective
Input Parameter:
term- aTaoTerm
Level: beginner
TaoTerm, TaoTermCreate(), TaoTermSetType(), TaoTermSetFromOptions(), TaoTermSetUp(), TaoTermView()
External Links
- PETSc Manual:
TaoTerm/TaoTermDestroy
PETSc.LibPETSc.TaoTermDuplicate — Method
newterm::TaoTerm = TaoTermDuplicate(petsclib::PetscLibType, term::TaoTerm, opt::TaoTermDuplicateOption)Duplicate a TaoTerm
Collective
Input Parameters:
term- aTaoTermopt-TAOTERM_DUPLICATE_SIZEONLYorTAOTERM_DUPLICATE_TYPE
Output Parameter:
newterm- the duplicateTaoTerm
Notes: This function duplicates the solution space layout and vector type, but does not duplicate parameters-related configuration such as the parameters layout, TaoTermParametersMode, Hessian matrix types, or finite-difference settings. These must be set separately on the new TaoTerm if needed.
If TAOTERM_DUPLICATE_SIZEONLY is used, then the duplicated term must have proper TaoTermType set with TaoTermSetType().
Level: intermediate
TaoTerm, TaoTermDuplicateOption
External Links
- PETSc Manual:
TaoTerm/TaoTermDuplicate
PETSc.LibPETSc.TaoTermGetCreateHessianMode — Method
Hpre_is_H::PetscBool,H_mattype::String,Hpre_mattype::String = TaoTermGetCreateHessianMode(petsclib::PetscLibType, term::TaoTerm)Get the behavior of TaoTermCreateHessianMatricesDefault().
Not collective
Input Parameter:
term- aTaoTerm
Output Parameters:
Hpre_is_H- (optional) shouldTaoTermCreateHessianMatricesDefault()make one matrix forHandHpre?H_mattype- (optional) theMatTypeto create forHHpre_mattype- (optional) theMatTypeto create forHpre
Level: developer
TaoTerm, TaoTermComputeHessian(), TaoTermCreateHessianMatrices(), TaoTermCreateHessianMatricesDefault(), TaoTermSetCreateHessianMode()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetCreateHessianMode
PETSc.LibPETSc.TaoTermGetFDDelta — Method
delta::PetscReal = TaoTermGetFDDelta(petsclib::PetscLibType, term::TaoTerm)Get the increment used for finite difference derivative approximations in methods like TaoTermComputeGradientFD()
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
delta- the finite difference increment
Options Database Key:
-tao_term_fd_delta <delta>- the above increment
Level: advanced
TaoTerm, TaoTermSetFDDelta(), TaoTermComputeGradientFD(), TaoTermComputeGradientSetUseFD(), TaoTermComputeGradientGetUseFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetFDDelta
PETSc.LibPETSc.TaoTermGetParametersLayout — Method
parameters_layout::PetscLayout = TaoTermGetParametersLayout(petsclib::PetscLibType, term::TaoTerm)Get the layouts describing the parameter vectors of a TaoTerm.
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
parameters_layout- thePetscLayoutfor the parameter space
Level: intermediate
TaoTerm, TaoTermGetParametersVecType(), TaoTermSetParametersVecType(), TaoTermSetParametersLayout(), TaoTermSetSolutionTemplate(), TaoTermSetParametersTemplate(), TaoTermCreateParametersVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetParametersLayout
PETSc.LibPETSc.TaoTermGetParametersMode — Method
parameters_mode::TaoTermParametersMode = TaoTermGetParametersMode(petsclib::PetscLibType, term::TaoTerm)Gets the way a TaoTerm can accept parameters
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
parameters_mode-TAOTERM_PARAMETERS_OPTIONAL,TAOTERM_PARAMETERS_NONE,TAOTERM_PARAMETERS_REQUIRED
Level: intermediate
TaoTerm, TaoTermParametersMode, TaoTermSetParametersMode()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetParametersMode
PETSc.LibPETSc.TaoTermGetParametersSizes — Method
k::PetscInt,M_K::PetscInt,bs::PetscInt = TaoTermGetParametersSizes(petsclib::PetscLibType, term::TaoTerm)Get the sizes describing the layout of the parameter vector space of a TaoTerm.
Not collective
Input Parameter:
term- aTaoTerm
Output Parameters:
k- (optional) the size of a parameter vector on the current MPI processK- (optional) the global size of a parameter vectorbs- (optional) the block size of a parameter vector
Level: beginner
TaoTerm, TaoTermSetParametersSizes(), TaoTermSetParametersTemplate(), TaoTermGetParametersVecType(), TaoTermSetParametersVecType(), TaoTermGetParametersLayout(), TaoTermSetParametersLayout(), TaoTermCreateParametersVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetParametersSizes
PETSc.LibPETSc.TaoTermGetParametersVecType — Method
parameters_type::String = TaoTermGetParametersVecType(petsclib::PetscLibType, term::TaoTerm)Get the vector types of the parameter vector of a TaoTerm
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
parameters_type- theVecTypefor the parameter space
Level: advanced
TaoTerm, TaoTermSetParametersVecType(), TaoTermGetParametersLayout(), TaoTermSetParametersLayout(), TaoTermSetSolutionTemplate(), TaoTermSetParametersTemplate(), TaoTermCreateParametersVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetParametersVecType
PETSc.LibPETSc.TaoTermGetSolutionLayout — Method
solution_layout::PetscLayout = TaoTermGetSolutionLayout(petsclib::PetscLibType, term::TaoTerm)Get the layouts describing the solution vectors of a TaoTerm.
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
solution_layout- thePetscLayoutfor the solution space
Level: intermediate
TaoTerm, TaoTermGetSolutionVecType(), TaoTermSetSolutionVecType(), TaoTermSetSolutionLayout(), TaoTermSetSolutionTemplate(), TaoTermSetParametersTemplate(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetSolutionLayout
PETSc.LibPETSc.TaoTermGetSolutionSizes — Method
n::PetscInt,M_N::PetscInt,bs::PetscInt = TaoTermGetSolutionSizes(petsclib::PetscLibType, term::TaoTerm)Get the sizes describing the layout of the solution vector space of a TaoTerm.
Not collective
Input Parameter:
term- aTaoTerm
Output Parameters:
n- (optional) the size of a solution vector on the current MPI processN- (optional) the global size of a solution vectorbs- (optional) the block size of a solution vector
Level: beginner
TaoTerm, TaoTermSetSolutionSizes(), TaoTermSetSolutionTemplate(), TaoTermGetSolutionVecType(), TaoTermSetSolutionVecType(), TaoTermGetSolutionLayout(), TaoTermSetSolutionLayout(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetSolutionSizes
PETSc.LibPETSc.TaoTermGetSolutionVecType — Method
solution_type::String = TaoTermGetSolutionVecType(petsclib::PetscLibType, term::TaoTerm)Get the vector types of the solution vector of a TaoTerm
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
solution_type- theVecTypefor the solution space
Level: advanced
TaoTerm, TaoTermSetSolutionVecType(), TaoTermGetSolutionLayout(), TaoTermSetSolutionLayout(), TaoTermSetSolutionTemplate(), TaoTermSetParametersTemplate(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetSolutionVecType
PETSc.LibPETSc.TaoTermGetType — Method
type::String = TaoTermGetType(petsclib::PetscLibType, term::TaoTerm)Get the type of a TaoTerm
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
type- theTaoTermType
Level: beginner
TaoTerm, TaoTermType, TaoTermCreate(), TaoTermSetType(), TaoTermSetFromOptions(), TaoTermSetUp(), TaoTermView(), TaoTermDestroy()
External Links
- PETSc Manual:
TaoTerm/TaoTermGetType
PETSc.LibPETSc.TaoTermIsComputeHessianFDPossible — Method
is_fdpossible::PetscBool3 = TaoTermIsComputeHessianFDPossible(petsclib::PetscLibType, term::TaoTerm)Whether this term can compute Hessian with finite differences with either -tao_term_hessian_use_fd, TaoTermComputeHessianSetUseFD(), or MATMFFD.
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
is_fdpossible- whether Hessian computation with finite differences is possible
Level: developer
TaoTerm, TaoTermComputeObjective(), TaoTermShellSetObjective(), TaoTermIsGradientDefined(), TaoTermIsObjectiveAndGradientDefined(), TaoTermIsHessianDefined()
External Links
- PETSc Manual:
TaoTerm/TaoTermIsComputeHessianFDPossible
PETSc.LibPETSc.TaoTermIsCreateHessianMatricesDefined — Method
is_defined::PetscBool = TaoTermIsCreateHessianMatricesDefined(petsclib::PetscLibType, term::TaoTerm)Whether this term can call TaoTermCreateHessianMatrices().
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
is_defined- whether the term can create new Hessian matrices
Level: developer
TaoTerm, TaoTermCreateHessianMatrices(), TaoTermShellSetCreateHessianMatrices(), TaoTermIsObjectiveDefined(), TaoTermIsGradientDefined(), TaoTermIsObjectiveAndGradientDefined(), TaoTermIsHessianDefined()
External Links
- PETSc Manual:
TaoTerm/TaoTermIsCreateHessianMatricesDefined
PETSc.LibPETSc.TaoTermIsGradientDefined — Method
is_defined::PetscBool = TaoTermIsGradientDefined(petsclib::PetscLibType, term::TaoTerm)Whether a standalone gradient operation is defined for this TaoTerm
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
is_defined- whether the gradient is defined
Note: This function strictly checks whether a dedicated gradient operation is defined. It does not check whether the gradient could be computed via other operations (e.g., an objective-and-gradient callback or finite differences). TaoTermComputeGradient() may still succeed even if this function returns PETSC_FALSE, by falling back to TaoTermComputeObjectiveAndGradient() or finite-difference approximation.
Level: developer
TaoTerm, TaoTermComputeGradient(), TaoTermShellSetGradient(), TaoTermIsObjectiveDefined(), TaoTermIsObjectiveAndGradientDefined(), TaoTermIsHessianDefined()
External Links
- PETSc Manual:
TaoTerm/TaoTermIsGradientDefined
PETSc.LibPETSc.TaoTermIsHessianDefined — Method
is_defined::PetscBool = TaoTermIsHessianDefined(petsclib::PetscLibType, term::TaoTerm)Whether a Hessian operation is defined for this TaoTerm
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
is_defined- whether the Hessian is defined
Note: This function strictly checks whether a dedicated Hessian operation is defined. It does not check whether the Hessian could be computed via finite differences. TaoTermComputeHessian() may still succeed even if this function returns PETSC_FALSE, if finite-difference Hessian computation has been enabled.
Level: developer
TaoTerm, TaoTermComputeHessian(), TaoTermShellSetHessian(), TaoTermIsObjectiveDefined(), TaoTermIsGradientDefined(), TaoTermIsObjectiveAndGradientDefined()
External Links
- PETSc Manual:
TaoTerm/TaoTermIsHessianDefined
PETSc.LibPETSc.TaoTermIsObjectiveAndGradientDefined — Method
is_defined::PetscBool = TaoTermIsObjectiveAndGradientDefined(petsclib::PetscLibType, term::TaoTerm)Whether a combined objective-and-gradient operation is defined for this TaoTerm
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
is_defined- whether the objective/gradient is defined
Note: This function strictly checks whether a dedicated combined objective-and-gradient operation is defined. It does not check whether the objective and gradient could be computed via separate objective and gradient operations. TaoTermComputeObjectiveAndGradient() may still succeed even if this function returns PETSC_FALSE, by falling back to separate TaoTermComputeObjective() and TaoTermComputeGradient() calls.
Level: developer
TaoTerm, TaoTermComputeObjectiveAndGradient(), TaoTermShellSetObjectiveAndGradient(), TaoTermIsObjectiveDefined(), TaoTermIsGradientDefined(), TaoTermIsHessianDefined()
External Links
- PETSc Manual:
TaoTerm/TaoTermIsObjectiveAndGradientDefined
PETSc.LibPETSc.TaoTermIsObjectiveDefined — Method
is_defined::PetscBool = TaoTermIsObjectiveDefined(petsclib::PetscLibType, term::TaoTerm)Whether a standalone objective operation is defined for this TaoTerm
Not collective
Input Parameter:
term- aTaoTerm
Output Parameter:
is_defined- whether the objective is defined
Note: This function strictly checks whether a dedicated objective operation is defined. It does not check whether the objective could be computed via other operations (e.g., an objective-and-gradient callback). TaoTermComputeObjective() may still succeed even if this function returns PETSC_FALSE, by falling back to TaoTermComputeObjectiveAndGradient().
Level: developer
TaoTerm, TaoTermComputeObjective(), TaoTermShellSetObjective(), TaoTermIsGradientDefined(), TaoTermIsObjectiveAndGradientDefined(), TaoTermIsHessianDefined()
External Links
- PETSc Manual:
TaoTerm/TaoTermIsObjectiveDefined
PETSc.LibPETSc.TaoTermL1GetEpsilon — Method
epsilon::PetscReal = TaoTermL1GetEpsilon(petsclib::PetscLibType, term::TaoTerm)Get the \epsilon smoothing parameter set by TaoTermL1SetEpsilon().
Not collective
Input Parameter:
term- aTaoTermof typeTAOTERML1
Output Parameter:
epsilon- the smoothing parameter
Level: advanced
TaoTerm, TAOTERML1, TaoTermL1SetEpsilon()
External Links
- PETSc Manual:
TaoTerm/TaoTermL1GetEpsilon
PETSc.LibPETSc.TaoTermL1SetEpsilon — Method
TaoTermL1SetEpsilon(petsclib::PetscLibType, term::TaoTerm, epsilon::PetscReal)Set an \epsilon smoothing parameter.
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERML1epsilon- a real number \geq 0
Options Database Keys:
-tao_term_l1_epsilon <real>- \epsilon
Level: advanced
If \epsilon = 0 (the default), then term computes \|x - p\|1, but if \epsilon > 0, then it computes \sum{i=0}^{n-1} \left(\sqrt{(xi-pi)^2 + \epsilon^2} - \epsilon\right).
TaoTerm, TAOTERML1, TaoTermL1GetEpsilon()
External Links
- PETSc Manual:
TaoTerm/TaoTermL1SetEpsilon
PETSc.LibPETSc.TaoTermQuadraticGetMat — Method
A::PetscMat = TaoTermQuadraticGetMat(petsclib::PetscLibType, term::TaoTerm)Get the matrix defining a TaoTerm of type TAOTERMQUADRATIC
Not collective
Input Parameter:
term- aTaoTermof typeTAOTERMQUADRATIC
Output Parameter:
A- the matrix
Level: intermediate
Note: This function will return NULL if the term is not a TAOTERMQUADRATIC.
TaoTerm, TAOTERMQUADRATIC, TaoTermQuadraticSetMat()
External Links
- PETSc Manual:
TaoTerm/TaoTermQuadraticGetMat
PETSc.LibPETSc.TaoTermQuadraticSetMat — Method
TaoTermQuadraticSetMat(petsclib::PetscLibType, term::TaoTerm, A::AbstractPetscMat)Set the matrix defining a TaoTerm of type TAOTERMQUADRATIC
Collective
Input Parameters:
term- aTaoTermof typeTAOTERMQUADRATICA- the matrix
Level: intermediate
TaoTerm, TAOTERMQUADRATIC, TaoTermQuadraticGetMat()
External Links
- PETSc Manual:
TaoTerm/TaoTermQuadraticSetMat
PETSc.LibPETSc.TaoTermRegister — Method
TaoTermRegister(petsclib::PetscLibType, sname::String, func::external)Register an implementation of TaoTerm
Not Collective, No Fortran Support
Input Parameters:
sname- name of a new user-defined termfunc- routine to create the context for theTaoTermType
See also: TaoTerm, TaoTermSetType()
External Links
- PETSc Manual:
TaoTerm/TaoTermRegister
PETSc.LibPETSc.TaoTermSetCreateHessianMode — Method
TaoTermSetCreateHessianMode(petsclib::PetscLibType, term::TaoTerm, Hpre_is_H::PetscBool, H_mattype::String, Hpre_mattype::String)Determine the behavior of TaoTermCreateHessianMatricesDefault().
Logically collective
Input Parameters:
term- aTaoTermHpre_is_H- shouldTaoTermCreateHessianMatricesDefault()make one matrix forHandHpre?H_mattype- theMatTypeto create forHHpre_mattype- theMatTypeto create forHpre
Options Database Keys:
-tao_term_hessian_pre_is_hessian <bool>- WhetherTaoTermCreateHessianMatrices()should make a separate matrix for constructing the preconditioner-tao_term_hessian_mat_type <type>-MatTypefor Hessian matrix created byTaoTermCreateHessianMatrices()-tao_term_hessian_pre_mat_type <type>-MatTypefor matrix from which a preconditioner can be created byTaoTermCreateHessianMatrices()
Level: developer
TaoTerm, TaoTermComputeHessian(), TaoTermCreateHessianMatrices(), TaoTermCreateHessianMatricesDefault(), TaoTermGetCreateHessianMode()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetCreateHessianMode
PETSc.LibPETSc.TaoTermSetFDDelta — Method
TaoTermSetFDDelta(petsclib::PetscLibType, term::TaoTerm, delta::PetscReal)Set the increment used for finite difference derivative approximations in methods like TaoTermComputeGradientFD()
Logically collective
Input Parameters:
term- aTaoTermdelta- the finite difference increment
Options Database Key:
-tao_term_fd_delta <delta>- the above increment
Level: advanced
TaoTerm, TaoTermGetFDDelta(), TaoTermComputeGradientFD(), TaoTermComputeGradientSetUseFD(), TaoTermComputeGradientGetUseFD(), TaoTermComputeHessianFD(), TaoTermComputeHessianSetUseFD(), TaoTermComputeHessianGetUseFD()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetFDDelta
PETSc.LibPETSc.TaoTermSetFromOptions — Method
TaoTermSetFromOptions(petsclib::PetscLibType, term::TaoTerm)Configure a TaoTerm from the PETSc options database
Collective
Input Parameter:
term- aTaoTerm
Options Database Keys:
-tao_term_type <type>- l1, halfl2squared; seeTaoTermTypefor a complete list-tao_term_solution_vec_type <type>- the type of vector to use for the solution, seeVecTypefor a complete list of vector types-tao_term_parameters_vec_type <type>- the type of vector to use for the parameters, seeVecTypefor a complete list of vector types-tao_term_parameters_mode <optional,none,required>-TAOTERM_PARAMETERS_OPTIONAL,TAOTERM_PARAMETERS_NONE,TAOTERM_PARAMETERS_REQUIRED-tao_term_hessian_pre_is_hessian <bool>- WhetherTaoTermCreateHessianMatricesDefault()should make a separate preconditioning matrix-tao_term_hessian_mat_type <type>-MatTypefor Hessian matrix created byTaoTermCreateHessianMatricesDefault()-tao_term_hessian_pre_mat_type <type>-MatTypefor approximate Hessian matrix used to construct the preconditioner created byTaoTermCreateHessianMatricesDefault()-tao_term_fd_delta <real>- Increment for finite difference derivative approximations inTaoTermComputeGradientFD()-tao_term_gradient_use_fd <bool>- Use finite differences inTaoTermComputeGradient(), overriding other user-provided or built-in routines-tao_term_hessian_use_fd <bool>- Use finite differences inTaoTermComputeHessian(), overriding other user-provided or built-in routines
Level: beginner
TaoTerm, TaoTermCreate(), TaoTermSetType(), TaoTermSetUp(), TaoTermView(), TaoTermDestroy()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetFromOptions
PETSc.LibPETSc.TaoTermSetParametersLayout — Method
TaoTermSetParametersLayout(petsclib::PetscLibType, term::TaoTerm, parameters_layout::PetscLayout)Set the layout describing the parameter vector of TaoTerm.
Collective
Input Parameters:
term- aTaoTermparameters_layout- thePetscLayoutfor the parameter space
Level: intermediate
Notes: The "parameter space" of a TaoTerm is the vector space of the fixed data p in f(x; p). Parameters are not optimized over. This is distinct from the "solution space" (set with TaoTermSetSolutionSizes()), which is the space of the optimization variable x. Some TaoTermTypes require the solution and parameter spaces to be related (e.g., have the same size); see the documentation for each type.
Alternatively, one may use TaoTermSetParametersSizes() or TaoTermSetParametersTemplate() to define the vector sizes.
TaoTerm, TaoTermGetParametersVecType(), TaoTermSetParametersVecType(), TaoTermGetParametersLayout(), TaoTermSetSolutionTemplate(), TaoTermSetParametersTemplate(), TaoTermCreateParametersVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetParametersLayout
PETSc.LibPETSc.TaoTermSetParametersMode — Method
TaoTermSetParametersMode(petsclib::PetscLibType, term::TaoTerm, parameters_mode::TaoTermParametersMode)Sets the way a TaoTerm can accept parameters
Logically collective
Input Parameters:
term- aTaoTermparameters_mode-TAOTERM_PARAMETERS_OPTIONAL,TAOTERM_PARAMETERS_NONE,TAOTERM_PARAMETERS_REQUIRED
Options Database Keys:
-tao_term_parameters_mode <optional,none,required>-TAOTERM_PARAMETERS_OPTIONAL,TAOTERM_PARAMETERS_NONE,TAOTERM_PARAMETERS_REQUIRED
Level: advanced
TaoTerm, TaoTermParametersMode, TaoTermGetParametersMode()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetParametersMode
PETSc.LibPETSc.TaoTermSetParametersSizes — Method
TaoTermSetParametersSizes(petsclib::PetscLibType, term::TaoTerm, k::PetscInt, M_K::PetscInt, bs::PetscInt)Set the sizes describing the layout of the parameter vector space of a TaoTerm.
Logically collective
Input Parameters:
term- aTaoTermk- the size of a parameter vector on the current MPI process (orPETSC_DECIDE)K- the global size of a parameter vector (orPETSC_DECIDE)bs- the block size of a parameter vector (must be >= 1)
Level: beginner
Notes: The "parameter space" of a TaoTerm is the vector space of the fixed data p in f(x; p). Parameters are not optimized over. This is distinct from the "solution space" (set with TaoTermSetSolutionSizes()), which is the space of the optimization variable x. Some TaoTermTypes require the solution and parameter spaces to be related (e.g., have the same size); see the documentation for each type.
Alternatively, one may use TaoTermSetParametersLayout() or TaoTermSetParametersTemplate() to define the vector sizes.
TaoTerm, TaoTermGetParametersSizes(), TaoTermSetParametersTemplate(), TaoTermGetParametersVecType(), TaoTermSetParametersVecType(), TaoTermGetParametersLayout(), TaoTermSetParametersLayout(), TaoTermCreateParametersVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetParametersSizes
PETSc.LibPETSc.TaoTermSetParametersTemplate — Method
TaoTermSetParametersTemplate(petsclib::PetscLibType, term::TaoTerm, params_template::AbstractPetscVec)Set the parameter vector space to match a template vector
Collective
Input Parameters:
term- aTaoTermparams_template- a vector with the desired size, layout, andVecTypeof parameter vectors forTaoTerm
Level: intermediate
Notes: The "parameter space" of a TaoTerm is the vector space of the fixed data p in f(x; p). Parameters are not optimized over. This is distinct from the "solution space" (set with TaoTermSetSolutionSizes()), which is the space of the optimization variable x. Some TaoTermTypes require the solution and parameter spaces to be related (e.g., have the same size); see the documentation for each type.
Alternatively, one may use TaoTermSetParametersSizes() or TaoTermSetParametersLayout() to define the vector sizes.
TaoTerm, TaoTermGetParametersVecType(), TaoTermSetParametersVecType(), TaoTermSetSolutionTemplate(), TaoTermGetParametersLayout(), TaoTermSetParametersLayout(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetParametersTemplate
PETSc.LibPETSc.TaoTermSetParametersVecType — Method
TaoTermSetParametersVecType(petsclib::PetscLibType, term::TaoTerm, parameters_type::String)Set the vector types of the parameters vector of a TaoTerm
Logically collective
Input Parameters:
term- aTaoTermparameters_type- theVecTypefor the parameters space
Options Database Keys:
-tao_term_parameters_vec_type <type>-VecTypefor complete list of vector types
Level: advanced
TaoTerm, TaoTermGetParametersVecType(), TaoTermSetParametersLayout(), TaoTermGetParametersLayout(), TaoTermSetParametersTemplate(), TaoTermCreateParametersVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetParametersVecType
PETSc.LibPETSc.TaoTermSetSolutionLayout — Method
TaoTermSetSolutionLayout(petsclib::PetscLibType, term::TaoTerm, solution_layout::PetscLayout)Set the layout describing the solution vector of TaoTerm.
Collective
Input Parameters:
term- aTaoTermsolution_layout- thePetscLayoutfor the solution space
Level: intermediate
Notes: The "solution space" of a TaoTerm is the vector space of the optimization variable x in f(x; p). This is distinct from the "parameter space" (the space of the fixed data p, set with TaoTermSetParametersSizes()). Some TaoTermTypes require the solution and parameter spaces to be related (e.g., have the same size); see the documentation for each type.
When a mapping matrix A is used to add a term to a Tao via TaoAddTerm(), the mapping transforms the Tao solution vector into this term's solution space. For example, if the Tao solution vector is x \in \mathbb{R}^n and the mapping matrix is A \in \mathbb{R}^{m \times n}, then the term evaluates f(Ax; p) with Ax \in \mathbb{R}^m. The term's solution space is therefore \mathbb{R}^m, and TaoTermView() will report N = m for this term.
Alternatively, one may use TaoTermSetSolutionSizes() or TaoTermSetSolutionTemplate() to define the vector sizes.
TaoTerm, TaoTermGetSolutionVecType(), TaoTermSetSolutionVecType(), TaoTermGetSolutionLayout(), TaoTermSetSolutionTemplate(), TaoTermSetParametersTemplate(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetSolutionLayout
PETSc.LibPETSc.TaoTermSetSolutionSizes — Method
TaoTermSetSolutionSizes(petsclib::PetscLibType, term::TaoTerm, n::PetscInt, M_N::PetscInt, bs::PetscInt)Set the sizes describing the layout of the solution vector space of a TaoTerm.
Logically collective
Input Parameters:
term- aTaoTermn- the size of a solution vector on the current MPI process (orPETSC_DECIDE)N- the global size of a solution vector (orPETSC_DECIDE)bs- the block size of a solution vector (must be >= 1)
Level: beginner
Notes: The "solution space" of a TaoTerm is the vector space of the optimization variable x in f(x; p). This is distinct from the "parameter space" (the space of the fixed data p, set with TaoTermSetParametersSizes()). Some TaoTermTypes require the solution and parameter spaces to be related (e.g., have the same size); see the documentation for each type.
When a mapping matrix A is used to add a term to a Tao via TaoAddTerm(), the mapping transforms the Tao solution vector into this term's solution space. For example, if the Tao solution vector is x \in \mathbb{R}^n and the mapping matrix is A \in \mathbb{R}^{m \times n}, then the term evaluates f(Ax; p) with Ax \in \mathbb{R}^m. The term's solution space is therefore \mathbb{R}^m, and TaoTermView() will report N = m for this term.
Alternatively, one may use TaoTermSetSolutionLayout() or TaoTermSetSolutionTemplate() to define the vector sizes.
TaoTerm, TaoTermGetSolutionSizes(), TaoTermSetSolutionTemplate(), TaoTermGetSolutionVecType(), TaoTermSetSolutionVecType(), TaoTermGetSolutionLayout(), TaoTermSetSolutionLayout(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetSolutionSizes
PETSc.LibPETSc.TaoTermSetSolutionTemplate — Method
TaoTermSetSolutionTemplate(petsclib::PetscLibType, term::TaoTerm, sol_template::AbstractPetscVec)Set the solution vector space to match a template vector
Collective
Input Parameters:
term- aTaoTermsol_template- a vector with the desired size, layout, andVecTypeof solution vectors forTaoTerm
Level: intermediate
Notes: The "solution space" of a TaoTerm is the vector space of the optimization variable x in f(x; p). This is distinct from the "parameter space" (the space of the fixed data p, set with TaoTermSetParametersSizes()). Some TaoTermTypes require the solution and parameter spaces to be related (e.g., have the same size); see the documentation for each type.
When a mapping matrix A is used to add a term to a Tao via TaoAddTerm(), the mapping transforms the Tao solution vector into this term's solution space. For example, if the Tao solution vector is x \in \mathbb{R}^n and the mapping matrix is A \in \mathbb{R}^{m \times n}, then the term evaluates f(Ax; p) with Ax \in \mathbb{R}^m. The term's solution space is therefore \mathbb{R}^m, and TaoTermView() will report N = m for this term.
Alternatively, one may use TaoTermSetSolutionSizes() or TaoTermSetSolutionLayout() to define the vector sizes.
TaoTerm, TaoTermGetSolutionVecType(), TaoTermSetSolutionVecType(), TaoTermSetParametersTemplate(), TaoTermGetSolutionLayout(), TaoTermSetSolutionLayout(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetSolutionTemplate
PETSc.LibPETSc.TaoTermSetSolutionVecType — Method
TaoTermSetSolutionVecType(petsclib::PetscLibType, term::TaoTerm, solution_type::String)Set the vector types of the solution vector of a TaoTerm
Logically collective
Input Parameters:
term- aTaoTermsolution_type- theVecTypefor the solution space
Options Database Keys:
-tao_term_solution_vec_type <type>-VecTypefor complete list of vector types
Level: advanced
TaoTerm, TaoTermGetSolutionVecType(), TaoTermSetSolutionLayout(), TaoTermGetSolutionLayout(), TaoTermSetSolutionTemplate(), TaoTermSetParametersTemplate(), TaoTermCreateSolutionVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetSolutionVecType
PETSc.LibPETSc.TaoTermSetType — Method
TaoTermSetType(petsclib::PetscLibType, term::TaoTerm, type::String)Set the type of a TaoTerm
Collective
Input Parameters:
term- aTaoTermtype- aTaoTermType
Options Database Keys:
-tao_term_type <type>- l1, halfl2squared,TaoTermTypefor complete list
Level: beginner
Notes: Use TaoTermCreateShell() to define a custom term using your own function definition
New types of TaoTerm can be created with TaoTermRegister()
TaoTerm, TaoTermType, TaoTermCreate(), TaoTermGetType(), TaoTermSetFromOptions(), TaoTermSetUp(), TaoTermView(), TaoTermDestroy()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetType
PETSc.LibPETSc.TaoTermSetUp — Method
TaoTermSetUp(petsclib::PetscLibType, term::TaoTerm)Set up a TaoTerm.
Collective
Input Parameter:
term- aTaoTerm
Level: intermediate
TaoTerm, TaoTermCreate(), TaoTermSetType(), TaoTermSetFromOptions(), TaoTermView(), TaoTermDestroy()
External Links
- PETSc Manual:
TaoTerm/TaoTermSetUp
PETSc.LibPETSc.TaoTermShellGetContext — Method
ctx::Ptr{Cvoid} = TaoTermShellGetContext(petsclib::PetscLibType, term::TaoTerm)Get the context for a TAOTERMSHELL
Not collective
Input Parameter:
term- aTaoTermof typeTAOTERMSHELL
Output Parameter:
ctx- a context
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellSetContext(), TaoTermShellSetContextDestroy()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellGetContext
PETSc.LibPETSc.TaoTermShellSetContext — Method
TaoTermShellSetContext(petsclib::PetscLibType, term::TaoTerm, ctx::Ptr{Cvoid})Set a context for a TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLctx- a context
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetContext
PETSc.LibPETSc.TaoTermShellSetContextDestroy — Method
TaoTermShellSetContextDestroy(petsclib::PetscLibType, term::TaoTerm, destroy::Ptr{Cvoid})Set a method to destroy the context resources when a TAOTERMSHELL is destroyed
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLdestroy- the context destroy function
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellSetContext(), TaoTermShellGetContext()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetContextDestroy
PETSc.LibPETSc.TaoTermShellSetCreateHessianMatrices — Method
TaoTermShellSetCreateHessianMatrices(petsclib::PetscLibType, term::TaoTerm, createmats::external)Set the routine that creates Hessian matrices for a TaoTerm of type TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLcreatemats- a function with the same signature asTaoTermCreateHessianMatrices()
Calling sequence of createmats:
f- theTaoTermH- (optional) a matrix of the appropriate type and size for the Hessian oftermHpre- (optional) a matrix of the appropriate type and size for constructing a preconditioner for the Hessian ofterm
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetCreateSolutionVec(), TaoTermShellSetCreateParametersVec()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetCreateHessianMatrices
PETSc.LibPETSc.TaoTermShellSetCreateParametersVec — Method
TaoTermShellSetCreateParametersVec(petsclib::PetscLibType, term::TaoTerm, createparametersvec::external)Set the routine that creates parameters vector for a TaoTerm of type TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLcreateparametersvec- a function with the same signature asTaoTermCreateParametersVec()
Calling sequence of createparametersvec:
term- theTaoTermparameters- a parameters vector forterm
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetCreateHessianMatrices()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetCreateParametersVec
PETSc.LibPETSc.TaoTermShellSetCreateSolutionVec — Method
TaoTermShellSetCreateSolutionVec(petsclib::PetscLibType, term::TaoTerm, createsolutionvec::external)Set the routine that creates solution vector for a TaoTerm of type TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLcreatesolutionvec- a function with the same signature asTaoTermCreateSolutionVec()
Calling sequence of createsolutionvec:
term- theTaoTermsolution- a solution vector forterm
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetCreateHessianMatrices()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetCreateSolutionVec
PETSc.LibPETSc.TaoTermShellSetGradient — Method
TaoTermShellSetGradient(petsclib::PetscLibType, term::TaoTerm, gradient::Ptr{Cvoid})Set the gradient function of a TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLgradient- aTaoTermGradientFnfunction pointer
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetObjective(), TaoTermShellSetObjectiveAndGradient(), TaoTermShellSetHessian(), TaoTermShellSetView(), TaoTermGradientFn
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetGradient
PETSc.LibPETSc.TaoTermShellSetHessian — Method
TaoTermShellSetHessian(petsclib::PetscLibType, term::TaoTerm, hessian::Ptr{Cvoid})Set the Hessian function of a TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLhessian- aTaoTermHessianFnfunction pointer
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetObjective(), TaoTermShellSetGradient(), TaoTermShellSetObjectiveAndGradient(), TaoTermShellSetView(), TaoTermHessianFn
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetHessian
PETSc.LibPETSc.TaoTermShellSetIsComputeHessianFDPossible — Method
TaoTermShellSetIsComputeHessianFDPossible(petsclib::PetscLibType, term::TaoTerm, ispossible::PetscBool3)Set whether this term can compute Hessian with finite differences for a TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLispossible- whether Hessian computation with finite differences is possible
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetObjective(), TaoTermShellSetGradient(), TaoTermShellSetObjectiveAndGradient(), TaoTermShellSetHessian(), TaoTermIsComputeHessianFDPossible()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetIsComputeHessianFDPossible
PETSc.LibPETSc.TaoTermShellSetObjective — Method
TaoTermShellSetObjective(petsclib::PetscLibType, term::TaoTerm, objective::Ptr{Cvoid})Set the objective function of a TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLobjective- aTaoTermObjectiveFnfunction pointer
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetGradient(), TaoTermShellSetObjectiveAndGradient(), TaoTermShellSetHessian(), TaoTermShellSetView(), TaoTermObjectiveFn
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetObjective
PETSc.LibPETSc.TaoTermShellSetObjectiveAndGradient — Method
TaoTermShellSetObjectiveAndGradient(petsclib::PetscLibType, term::TaoTerm, objandgrad::Ptr{Cvoid})Set the objective and gradient function of a TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLobjandgrad- aTaoTermObjectiveAndGradientFnfunction pointer
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetObjective(), TaoTermShellSetGradient(), TaoTermShellSetHessian(), TaoTermShellSetView(), TaoTermObjectiveAndGradientFn
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetObjectiveAndGradient
PETSc.LibPETSc.TaoTermShellSetView — Method
TaoTermShellSetView(petsclib::PetscLibType, term::TaoTerm, view::external)Set the view function of a TAOTERMSHELL
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSHELLview- a function with the same signature asTaoTermView()
Calling sequence of view:
term- theTaoTermviewer- aPetscViewer
Level: intermediate
See also: TaoTerm, TAOTERMSHELL, TaoTermShellGetContext(), TaoTermShellSetContextDestroy(), TaoTermShellSetObjective(), TaoTermShellSetGradient(), TaoTermShellSetObjectiveAndGradient(), TaoTermShellSetHessian()
External Links
- PETSc Manual:
TaoTerm/TaoTermShellSetView
PETSc.LibPETSc.TaoTermSumAddTerm — Method
index::PetscInt = TaoTermSumAddTerm(petsclib::PetscLibType, sumterm::TaoTerm, prefix::String, scale::PetscReal, term::TaoTerm, map::AbstractPetscMat)Append a term to the terms being summed
Collective
Input Parameters:
sumterm- aTaoTermof typeTAOTERMSUMprefix- (optional) the prefix used for configuring the term (ifNULL, the index of the term will be used as a prefix, e.g.term_0_,term_1_, etc.)scale- the coefficient scaling the term in the sumterm- theTaoTermto addmap- (optional) a map from theTAOTERMSUMsolution space to thetermsolution space; ifNULLthe map is assumed to be the identity
Output Parameter:
index- (optional) the index of the newly added term
Level: developer
See also: TaoTerm, TAOTERMSUM
External Links
- PETSc Manual:
TaoTerm/TaoTermSumAddTerm
PETSc.LibPETSc.TaoTermSumGetLastTermObjectives — Method
values::Ptr{PetscReal} = TaoTermSumGetLastTermObjectives(petsclib::PetscLibType, term::TaoTerm)Get the contributions from each term to the last evaluation of TaoTermComputeObjective() or TaoTermComputeObjectiveAndGradient()
Not collective
Input Parameter:
term- aTaoTermof typeTAOTERMSUM
Output Parameter:
values- an array of the contributions to the last computed objective value
Level: developer
TaoTerm, TAOTERMSUM
External Links
- PETSc Manual:
TaoTerm/TaoTermSumGetLastTermObjectives
PETSc.LibPETSc.TaoTermSumGetNumberTerms — Method
n_terms::PetscInt = TaoTermSumGetNumberTerms(petsclib::PetscLibType, term::TaoTerm)Get the number of terms in the sum
Not collective
Input Parameter:
term- aTaoTermof typeTAOTERMSUM
Output Parameter:
n_terms- the number of terms that will be in the sum
Level: developer
TaoTerm, TAOTERMSUM, TaoTermSumSetNumberTerms()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumGetNumberTerms
PETSc.LibPETSc.TaoTermSumGetTerm — Method
prefix::String,scale::PetscReal,term::TaoTerm,map::PetscMat = TaoTermSumGetTerm(petsclib::PetscLibType, sumterm::TaoTerm, index::PetscInt)Get the data for a term in a TAOTERMSUM
Not collective
Input Parameters:
sumterm- aTaoTermof typeTAOTERMSUMindex- a number 0 \leq i < n, where n is the number of terms inTaoTermSumGetNumberTerms()
Output Parameters:
prefix- (optional) the prefix used for configuring the termscale- (optional) the coefficient scaling the term in the sumterm- theTaoTermat given index ofTAOTERMSUMmap- (optional) a map from theTAOTERMSUMsolution space to thetermsolution space; ifNULLthe map is assumed to be the identity
Level: developer
TaoTerm, TAOTERMSUM, TaoTermSumSetTerm(), TaoTermSumAddTerm()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumGetTerm
PETSc.LibPETSc.TaoTermSumGetTermHessianMatrices — Method
unmapped_H::PetscMat,unmapped_Hpre::PetscMat,mapped_H::PetscMat,mapped_Hpre::PetscMat = TaoTermSumGetTermHessianMatrices(petsclib::PetscLibType, term::TaoTerm, index::PetscInt)Get Hessian matrices set with TaoTermSumSetTermHessianMatrices().
Not collective
Input Parameters:
term- aTaoTermof typeTAOTERMSUMindex- the index for the term fromTaoTermSumSetTerm()orTaoTermSumAddTerm()
Output Parameters:
unmapped_H- (optional) unmapped Hessian matrixunmapped_Hpre- (optional) unmapped matrix for constructing the preconditioner forunmapped_Hmapped_H- (optional) Hessian matrixmapped_Hpre- (optional) matrix for constructing the preconditioner formapped_H
Level: developer
TaoTerm, TAOTERMSUM, TaoTermComputeHessian(), TaoTermSumSetTermHessianMatrices()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumGetTermHessianMatrices
PETSc.LibPETSc.TaoTermSumGetTermMask — Method
mask::TaoTermMask = TaoTermSumGetTermMask(petsclib::PetscLibType, term::TaoTerm, index::PetscInt)Get the TaoTermMask of a term in the sum
Not collective
Input Parameters:
term- aTaoTermof typeTAOTERMSUMindex- the index for the term fromTaoTermSumSetTerm()orTaoTermSumAddTerm()
Output Parameter:
mask- a bitmask ofTaoTermMaskevaluation methods to mask (e.g. justTAOTERM_MASK_OBJECTIVEor a bitwise-or likeTAOTERM_MASK_OBJECTIVE | TAOTERM_MASK_GRADIENT)
Level: developer
TaoTerm, TAOTERMSUM, TaoTermSumSetTermMask()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumGetTermMask
PETSc.LibPETSc.TaoTermSumParametersPack — Method
params::PetscVec = TaoTermSumParametersPack(petsclib::PetscLibType, term::TaoTerm, p_arr::Vector{<:AbstractPetscVec})Concatenate the parameters for terms into a VECNEST parameter vector for a TAOTERMSUM
Collective
Input Parameters:
term- aTaoTermof typeTAOTERMSUMp_arr- an array of parametersVecs, one for each term in the sum. An entry can beNULLfor a term that doesn't take parameters.
Output Parameter:
params- aVecof typeVECNESTthat concatenates all of the parameters
Level: developer
Note: This is a wrapper around VecCreateNest(), but that function does not allow NULL for any of the Vecs in the array. A 0-length vector will be created for each NULL Vec that will be internally ignored by TAOTERMSUM.
TaoTerm, TAOTERMSUM, TaoTermSumParametersUnpack(), VECNEST, VecNestGetTaoTermSumParameters(), VecCreateNest()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumParametersPack
PETSc.LibPETSc.TaoTermSumParametersUnpack — Method
TaoTermSumParametersUnpack(petsclib::PetscLibType, term::TaoTerm, params::AbstractPetscVec, p_arr::Vector{<:AbstractPetscVec})Unpack the concatenated parameters created by TaoTermSumParametersPack() and destroy the VECNEST
Collective
Input Parameters:
term- aTaoTermof typeTAOTERMSUMparams- aVeccreated byTaoTermSumParametersPack()
Output Parameter:
p_arr- an array of parametersVecs, one for each term in the sum. An entry will beNULLifNULLwas passed in the same position ofTaoTermSumParametersPack()
Level: intermediate
TaoTerm, TAOTERMSUM, TaoTermSumParametersPack(), VecNestGetTaoTermSumParameters()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumParametersUnpack
PETSc.LibPETSc.TaoTermSumSetNumberTerms — Method
TaoTermSumSetNumberTerms(petsclib::PetscLibType, term::TaoTerm, n_terms::PetscInt)Set the number of terms in the sum
Collective
Input Parameters:
term- aTaoTermof typeTAOTERMSUMn_terms- the number of terms that will be in the sum
Level: developer
Note: If n_terms is smaller than the current number of terms, the trailing terms will be dropped.
TaoTerm, TAOTERMSUM, TaoTermSumGetNumberTerms()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumSetNumberTerms
PETSc.LibPETSc.TaoTermSumSetTerm — Method
TaoTermSumSetTerm(petsclib::PetscLibType, sumterm::TaoTerm, index::PetscInt, prefix::String, scale::PetscReal, term::TaoTerm, map::AbstractPetscMat)Set a term in a sum of terms
Collective
Input Parameters:
sumterm- aTaoTermof typeTAOTERMSUMindex- a number 0 \leq i < n, where n is the number of terms inTaoTermSumSetNumberTerms()prefix- (optional) the prefix used for configuring the term (ifNULL,term_x_will be the prefix, e.g. "term0", "term1", etc.)scale- the coefficient scaling the term in the sumterm- theTaoTermto be set inTAOTERMSUMmap- (optional) a map from theTAOTERMSUMsolution space to thetermsolution space; ifNULLthe map is assumed to be the identity
Level: developer
TaoTerm, TAOTERMSUM, TaoTermSumGetTerm(), TaoTermSumAddTerm()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumSetTerm
PETSc.LibPETSc.TaoTermSumSetTermHessianMatrices — Method
TaoTermSumSetTermHessianMatrices(petsclib::PetscLibType, term::TaoTerm, index::PetscInt, unmapped_H::AbstractPetscMat, unmapped_Hpre::AbstractPetscMat, mapped_H::AbstractPetscMat, mapped_Hpre::AbstractPetscMat)Set Hessian matrices that can be used internally by a TAOTERMSUM
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSUMindex- the index for the term fromTaoTermSumSetTerm()orTaoTermSumAddTerm()unmapped_H- (optional) unmapped Hessian matrixunmapped_Hpre- (optional) unmapped matrix for constructing the preconditioner ofunmapped_Hmapped_H- (optional) Hessian matrixmapped_Hpre- (optional) matrix for constructing the preconditioner ofmapped_H
Level: developer
Notes: If the inner term has the form g(x) = \alpha f(Ax; p), the "mapped" Hessians should be able to hold the Hessian \nabla^2 g and the unmapped Hessians should be able to hold the Hessian \nabla_x^2 f. If the term is not mapped, just pass the unmapped Hessians (e.g. TaoTermSumSetTermHessianMatrices(term, 0, H, Hpre, NULL, NULL)).
TaoTerm, TAOTERMSUM, TaoTermComputeHessian(), TaoTermSumGetTermHessianMatrices()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumSetTermHessianMatrices
PETSc.LibPETSc.TaoTermSumSetTermMask — Method
TaoTermSumSetTermMask(petsclib::PetscLibType, term::TaoTerm, index::PetscInt, mask::TaoTermMask)Set a TaoTermMask on a term in the sum
Logically collective
Input Parameters:
term- aTaoTermof typeTAOTERMSUMindex- the index for the term fromTaoTermSumSetTerm()orTaoTermSumAddTerm()mask- a bitmask ofTaoTermMaskevaluation methods to mask (e.g. justTAOTERM_MASK_OBJECTIVEor a bitwise-or likeTAOTERM_MASK_OBJECTIVE | TAOTERM_MASK_GRADIENT)
Options Database Keys:
-tao_term_sum_<prefix_>mask- a list containing any ofnone,objective,gradient, andhessianto indicate which evaluations to mask for a term with a given prefix (seeTaoTermSumSetTerm())
Level: developer
Note: Some optimization methods may add a damping term to the Hessian of an objective function without affecting the objective or gradient. If, e.g., the regularizer has index 1, then this can be accomplished with TaoTermSumSetTermMask(term, 1, TAOTERM_MASK_OBJECTIVE | TAOTERM_MASK_GRADIENT).
TaoTerm, TAOTERMSUM, TaoTermSumGetTermMask()
External Links
- PETSc Manual:
TaoTerm/TaoTermSumSetTermMask
PETSc.LibPETSc.TaoTermView — Method
TaoTermView(petsclib::PetscLibType, term::TaoTerm, viewer::PetscViewer)View a description of a TaoTerm.
Collective
Input Parameters:
term- aTaoTermviewer- aPetscViewer
Level: beginner
TaoTerm, TaoTermCreate(), TaoTermSetType(), TaoTermSetFromOptions(), TaoTermSetUp(), TaoTermDestroy(), PetscViewer
External Links
- PETSc Manual:
TaoTerm/TaoTermView