Skip to main content
`Ctrl`+`K`

# TaoTermSetSolutionTemplate

Set the solution vector space to match a template vector

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoTermSetSolutionTemplate(TaoTerm term, Vec sol_template)

Collective

## Input Parameters

- term - a `TaoTerm`

- sol_template - a vector with the desired size, layout, and `VecType` of solution vectors for `TaoTerm`

## 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 `TaoTermType`s 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.

## See Also

TaoTerm: composable objective function terms, `TaoTerm`, `TaoTermGetSolutionVecType()`, `TaoTermSetSolutionVecType()`, `TaoTermSetParametersTemplate()`, `TaoTermGetSolutionLayout()`, `TaoTermSetSolutionLayout()`, `TaoTermCreateSolutionVec()`

## Level

intermediate

## Location

src/tao/term/interface/taoterm.c

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