Skip to main content
`Ctrl`+`K`

# TaoTermCreateSolutionVec

Create a solution vector for a `TaoTerm`

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoTermCreateSolutionVec(TaoTerm term, Vec *solution)

Collective

## Input Parameter

- term - a `TaoTerm`

## Output Parameter

- solution - a compatible solution vector for `term`

## 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 set `PetscLayout`s for the solution vector.

- Call `TaoTermSetSolutionTemplate()` to set the solution vector spaces to match existing `Vec`.

- If the `TaoTerm` is a `TAOTERMSHELL`, you can call `TaoTermShellSetCreateSolutionVec()` to use your own code for creating vectors.

You can also call `TaoTermSetSolutionVecType()` to set the type of vector created (e.g. `VECCUDA`).

## See Also

TaoTerm: composable objective function terms, `TaoTerm`, `TaoTermShellSetCreateSolutionVec()`, `TaoTermGetSolutionSizes()`, `TaoTermSetSolutionSizes()`, `TaoTermSetSolutionTemplate()`, `TaoTermGetSolutionVecType()`, `TaoTermSetSolutionVecType()`, `TaoTermGetSolutionLayout()`, `TaoTermSetSolutionLayout()`, `TaoTermCreateHessianMatrices()`

## Level

advanced

## Location

src/tao/term/interface/taoterm.c

## Examples

src/tao/unconstrained/tutorials/elastic_net_regularization.c

## Implementations

TaoTermCreateSolutionVec_Test() in src/tao/term/impls/shell/tests/ex1.c
TaoTermCreateSolutionVec_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