# TaoSetRecycleHistory
Sets the boolean flag to enable/disable re-using iterate information from the previous `TaoSolve()`. This feature is disabled by default. 
## Synopsis
```
#include "petsctao.h" 
PetscErrorCode TaoSetRecycleHistory(Tao tao, PetscBool recycle)
```
For conjugate gradient methods (`TAOBNCG`), this re-uses the latest search direction
from the previous `TaoSolve()` call when computing the first search direction in a
new solution. By default, CG methods set the first search direction to the
negative gradient.

For quasi-Newton family of methods (`TAOBQNLS`, `TAOBQNKLS`, `TAOBQNKTR`, `TAOBQNKTL`), this re-uses
the accumulated quasi-Newton Hessian approximation from the previous `TaoSolve()`
call. By default, QN family of methods reset the initial Hessian approximation to
the identity matrix.

For any other algorithm, this setting has no effect.

Logically collective on tao


## Input Parameters

- ***tao -*** the Tao context
- ***recycle -*** boolean flag



## Options Database Keys

- ***-tao_recycle_history <true,false> -*** reuse the history





## See Also
 `TaoGetRecycleHistory()`, `TAOBNCG`, `TAOBQNLS`, `TAOBQNKLS`, `TAOBQNKTR`, `TAOBQNKTL`


## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/interface/taosolver.c.html#TaoSetRecycleHistory">src/tao/interface/taosolver.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/rosenbrock3.c.html">src/tao/unconstrained/tutorials/rosenbrock3.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/tao/interface/taosolver.c)


[Index of all Tao routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
