Another routine needed by most solvers destroys the data structures
creates by earlier routines. For the nonlinear conjugate gradient
method discussed earlier, the following routine destroys the two
work vectors, the line search, and the TAO_CG structure.
int TaoDestroy_CG(TAO_SOLVER tao, void *solver)
{
TAO_CG *cg = (TAO_CG *) solver;
int info;
TaoFunctionBegin;
info = TaoVecDestroy(cg->gg); CHKERRQ(info);
info = TaoVecDestroy(cg->ww);CHKERRQ(info);
info = TaoVecDestroy(cg->dx);CHKERRQ(info);
info = TaoLineSearchDestroy(tao);CHKERRQ(info);
TaoFree(cg);
TaoFunctionReturn(0);
}
Other algorithms may destroy matrices, linear solvers, index sets, or
other objects needed by the solver. This routine is called from within
the TaoDestroy() routine.