TaoTermSumSetTermMask — PETSc 3.25.2 documentation

Skip to main content
`Ctrl`+`K`

# TaoTermSumSetTermMask

Set a `TaoTermMask` on a term in the sum

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoTermSumSetTermMask(TaoTerm term, PetscInt index, TaoTermMask mask)

Logically collective

## Input Parameters

- term - a `TaoTerm` of type `TAOTERMSUM`

- index - the index for the term from `TaoTermSumSetTerm()` or `TaoTermSumAddTerm()`

- mask - a bitmask of `TaoTermMask` evaluation methods to mask (e.g. just `TAOTERM_MASK_OBJECTIVE` or a bitwise-or like `TAOTERM_MASK_OBJECTIVE | TAOTERM_MASK_GRADIENT`)

## Options Database Keys

- -tao_term_sum_<prefix_>mask - a list containing any of `none`, `objective`, `gradient`, and `hessian` to indicate which evaluations to mask for a term with a given prefix (see `TaoTermSumSetTerm()`)

## 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)`.

## See Also

TaoTerm: composable objective function terms, `TaoTerm`, `TAOTERMSUM`, `TaoTermSumGetTermMask()`

## Level

developer

## Location

src/tao/term/impls/sum/taotermsum.c

## Implementations

TaoTermSumSetTermMask_Sum() in src/tao/term/impls/sum/taotermsum.c

Index of all TaoTerm routines
Table of Contents for all manual pages
Index of all manual pages