Lines Matching refs:tao
9 + tao - the `Tao` context
17 PetscErrorCode TaoSetVariableBounds(Tao tao, Vec XL, Vec XU)
20 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
25 PetscCall(VecDestroy(&tao->XL));
26 PetscCall(VecDestroy(&tao->XU));
27 tao->XL = XL;
28 tao->XU = XU;
29 tao->bounded = (PetscBool)(XL || XU);
39 + tao - the `Tao` context
44 + tao - the `Tao` solver
56 PetscErrorCode TaoSetVariableBoundsRoutine(Tao tao, PetscErrorCode (*func)(Tao tao, Vec xl, Vec xu, PetscCtx ctx), PetscCtx ctx)
59 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
60 tao->user_boundsP = ctx;
61 tao->ops->computebounds = func;
62 tao->bounded = func ? PETSC_TRUE : PETSC_FALSE;
72 . tao - the `Tao` context
82 PetscErrorCode TaoGetVariableBounds(Tao tao, Vec *XL, Vec *XU)
85 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
86 if (XL) *XL = tao->XL;
87 if (XU) *XU = tao->XU;
98 . tao - the `Tao` context
104 PetscErrorCode TaoComputeVariableBounds(Tao tao)
107 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
108 if (tao->ops->computebounds) {
109 if (!tao->XL) {
110 PetscCall(VecDuplicate(tao->solution, &tao->XL));
111 PetscCall(VecSet(tao->XL, PETSC_NINFINITY));
113 if (!tao->XU) {
114 PetscCall(VecDuplicate(tao->solution, &tao->XU));
115 PetscCall(VecSet(tao->XU, PETSC_INFINITY));
117 PetscCallBack("Tao callback variable bounds", (*tao->ops->computebounds)(tao, tao->XL, tao->XU, tao->user_boundsP));
128 + tao - the `Tao` context
136 PetscErrorCode TaoSetInequalityBounds(Tao tao, Vec IL, Vec IU)
139 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
144 PetscCall(VecDestroy(&tao->IL));
145 PetscCall(VecDestroy(&tao->IU));
146 tao->IL = IL;
147 tao->IU = IU;
148 tao->ineq_doublesided = (PetscBool)(IL || IU);
158 . tao - the `Tao` context
168 PetscErrorCode TaoGetInequalityBounds(Tao tao, Vec *IL, Vec *IU)
171 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
172 if (IL) *IL = tao->IL;
173 if (IU) *IU = tao->IU;
184 + tao - the `Tao` context
194 PetscErrorCode TaoComputeConstraints(Tao tao, Vec X, Vec C)
197 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
200 PetscCheckSameComm(tao, 1, X, 2);
201 PetscCheckSameComm(tao, 1, C, 3);
202 PetscCall(PetscLogEventBegin(TAO_ConstraintsEval, tao, X, C, NULL));
203 PetscCallBack("Tao callback constraints", (*tao->ops->computeconstraints)(tao, X, C, tao->user_conP));
204 PetscCall(PetscLogEventEnd(TAO_ConstraintsEval, tao, X, C, NULL));
205 tao->nconstraints++;
215 + tao - the `Tao` context
221 + tao - the `Tao` solver
230 PetscErrorCode TaoSetConstraintsRoutine(Tao tao, Vec c, PetscErrorCode (*func)(Tao tao, Vec x, Vec c, PetscCtx ctx), PetscCtx ctx)
233 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
236 PetscCall(VecDestroy(&tao->constraints));
237 tao->constrained = func ? PETSC_TRUE : PETSC_FALSE;
238 tao->constraints = c;
239 tao->user_conP = ctx;
240 tao->ops->computeconstraints = func;
251 . tao - the `Tao` context
266 PetscErrorCode TaoComputeDualVariables(Tao tao, Vec DL, Vec DU)
269 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
272 PetscCheckSameComm(tao, 1, DL, 2);
273 PetscCheckSameComm(tao, 1, DU, 3);
274 if (tao->ops->computedual) {
275 PetscUseTypeMethod(tao, computedual, DL, DU);
289 . tao - the `Tao` context
299 PetscErrorCode TaoGetDualVariables(Tao tao, Vec *DE, Vec *DI)
302 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
303 if (DE) *DE = tao->DE;
304 if (DI) *DI = tao->DI;
314 + tao - the `Tao` context
320 + tao - the `Tao` solver
329 PetscErrorCode TaoSetEqualityConstraintsRoutine(Tao tao, Vec ce, PetscErrorCode (*func)(Tao tao, Vec x, Vec ce, PetscCtx ctx), PetscCtx ctx)
332 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
335 PetscCall(VecDestroy(&tao->constraints_equality));
336 tao->eq_constrained = func ? PETSC_TRUE : PETSC_FALSE;
337 tao->constraints_equality = ce;
338 tao->user_con_equalityP = ctx;
339 tao->ops->computeequalityconstraints = func;
349 . tao - the `Tao` context
357 + tao - the `Tao` solver
366 PetscErrorCode TaoGetEqualityConstraintsRoutine(Tao tao, Vec *ci, PetscErrorCode (**func)(Tao tao, Vec x, Vec ci, PetscCtx ctx), PetscCtxRt ctx)
369 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
370 if (ci) *ci = tao->constraints_equality;
371 if (func) *func = tao->ops->computeequalityconstraints;
372 if (ctx) *(void **)ctx = tao->user_con_equalityP;
382 + tao - the `Tao` context
388 + tao - the `Tao` solver
397 PetscErrorCode TaoSetInequalityConstraintsRoutine(Tao tao, Vec ci, PetscErrorCode (*func)(Tao tao, Vec x, Vec ci, PetscCtx ctx), PetscCtx ctx)
400 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
403 PetscCall(VecDestroy(&tao->constraints_inequality));
404 tao->constraints_inequality = ci;
405 tao->ineq_constrained = func ? PETSC_TRUE : PETSC_FALSE;
406 tao->user_con_inequalityP = ctx;
407 tao->ops->computeinequalityconstraints = func;
417 . tao - the `Tao` context
425 + tao - the `Tao` solver
434 PetscErrorCode TaoGetInequalityConstraintsRoutine(Tao tao, Vec *ci, PetscErrorCode (**func)(Tao tao, Vec x, Vec ci, PetscCtx ctx), PetscCtxRt ctx)
437 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
438 if (ci) *ci = tao->constraints_inequality;
439 if (func) *func = tao->ops->computeinequalityconstraints;
440 if (ctx) *(void **)ctx = tao->user_con_inequalityP;
451 . tao - the `Tao` context
461 PetscErrorCode TaoComputeEqualityConstraints(Tao tao, Vec X, Vec CE)
464 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
467 PetscCheckSameComm(tao, 1, X, 2);
468 PetscCheckSameComm(tao, 1, CE, 3);
469 PetscCall(PetscLogEventBegin(TAO_ConstraintsEval, tao, X, CE, NULL));
470 PetscCallBack("Tao callback equality constraints", (*tao->ops->computeequalityconstraints)(tao, X, CE, tao->user_con_equalityP));
471 PetscCall(PetscLogEventEnd(TAO_ConstraintsEval, tao, X, CE, NULL));
472 tao->nconstraints++;
483 . tao - the `Tao` context
493 PetscErrorCode TaoComputeInequalityConstraints(Tao tao, Vec X, Vec CI)
496 PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
499 PetscCheckSameComm(tao, 1, X, 2);
500 PetscCheckSameComm(tao, 1, CI, 3);
501 PetscCall(PetscLogEventBegin(TAO_ConstraintsEval, tao, X, CI, NULL));
502 PetscCallBack("Tao callback inequality constraints", (*tao->ops->computeinequalityconstraints)(tao, X, CI, tao->user_con_inequalityP));
503 PetscCall(PetscLogEventEnd(TAO_ConstraintsEval, tao, X, CI, NULL));
504 tao->nconstraints++;