Lines Matching refs:tao
88 PetscErrorCode TaoSolve_BNLS(Tao tao) in TaoSolve_BNLS() argument
90 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoSolve_BNLS()
99 tao->reason = TAO_CONTINUE_ITERATING; in TaoSolve_BNLS()
100 PetscCall(TaoBNKInitialize(tao, bnk->init_type, &needH)); in TaoSolve_BNLS()
101 if (tao->reason != TAO_CONTINUE_ITERATING) PetscFunctionReturn(PETSC_SUCCESS); in TaoSolve_BNLS()
104 while (tao->reason == TAO_CONTINUE_ITERATING) { in TaoSolve_BNLS()
106 if (tao->ops->update) { in TaoSolve_BNLS()
107 PetscUseTypeMethod(tao, update, tao->niter, tao->user_update); in TaoSolve_BNLS()
108 PetscCall(TaoComputeObjective(tao, tao->solution, &bnk->f)); in TaoSolve_BNLS()
113 PetscCall(TaoBNKTakeCGSteps(tao, &cgTerminate)); in TaoSolve_BNLS()
115 tao->reason = bnk->bncg->reason; in TaoSolve_BNLS()
119 PetscCall((*bnk->computehessian)(tao)); in TaoSolve_BNLS()
124 PetscCall((*bnk->computestep)(tao, shift, &ksp_reason, &stepType)); in TaoSolve_BNLS()
125 PetscCall(TaoBNKSafeguardStep(tao, ksp_reason, &stepType)); in TaoSolve_BNLS()
129 PetscCall(VecCopy(tao->solution, bnk->Xold)); in TaoSolve_BNLS()
130 PetscCall(VecCopy(tao->gradient, bnk->Gold)); in TaoSolve_BNLS()
134 PetscCall(TaoBNKPerformLineSearch(tao, &stepType, &steplen, &ls_reason)); in TaoSolve_BNLS()
140 PetscCall(VecCopy(bnk->Xold, tao->solution)); in TaoSolve_BNLS()
141 PetscCall(VecCopy(bnk->Gold, tao->gradient)); in TaoSolve_BNLS()
144 tao->reason = TAO_DIVERGED_LS_FAILURE; in TaoSolve_BNLS()
149 PetscCall(TaoBNKEstimateActiveSet(tao, bnk->as_type)); in TaoSolve_BNLS()
150 PetscCall(VecCopy(bnk->unprojected_gradient, tao->gradient)); in TaoSolve_BNLS()
151 if (bnk->active_idx) PetscCall(VecISSet(tao->gradient, bnk->active_idx, 0.0)); in TaoSolve_BNLS()
152 PetscCall(TaoGradientNorm(tao, tao->gradient, NORM_2, &bnk->gnorm)); in TaoSolve_BNLS()
154 PetscCall(TaoBNKUpdateTrustRadius(tao, 0.0, 0.0, BNK_UPDATE_STEP, stepType, &stepAccepted)); in TaoSolve_BNLS()
156 PetscCall(TaoBNKAddStepCounts(tao, stepType)); in TaoSolve_BNLS()
162 PetscCall(VecFischer(tao->solution, bnk->unprojected_gradient, tao->XL, tao->XU, bnk->W)); in TaoSolve_BNLS()
164 …PetscCheck(!PetscIsInfOrNanReal(resnorm), PetscObjectComm((PetscObject)tao), PETSC_ERR_USER, "User… in TaoSolve_BNLS()
165 ++tao->niter; in TaoSolve_BNLS()
166 PetscCall(TaoLogConvergenceHistory(tao, bnk->f, resnorm, 0.0, tao->ksp_its)); in TaoSolve_BNLS()
167 PetscCall(TaoMonitor(tao, tao->niter, bnk->f, resnorm, 0.0, steplen)); in TaoSolve_BNLS()
168 PetscUseTypeMethod(tao, convergencetest, tao->cnvP); in TaoSolve_BNLS()
184 PETSC_EXTERN PetscErrorCode TaoCreate_BNLS(Tao tao) in TaoCreate_BNLS() argument
189 PetscCall(TaoCreate_BNK(tao)); in TaoCreate_BNLS()
190 tao->ops->solve = TaoSolve_BNLS; in TaoCreate_BNLS()
192 bnk = (TAO_BNK *)tao->data; in TaoCreate_BNLS()