Skip to main content
`Ctrl`+`K`

# petsc4py.PETSc.TAOLineSearch

class petsc4py.PETSc.TAOLineSearch

  Bases: `Object`

  TAO Line Search.

  Enumerations

  `ConvergedReason` | TAO Line Search Termination Reasons.
  `Type` | TAO Line Search Types.

  Methods Summary

  `apply`(x, g, s) | Performs a line-search in a given step direction.
  `create`([comm]) | Create a TAO linesearch.
  `destroy`() | Destroy the linesearch object.
  `getOptionsPrefix`() | Return the prefix used for searching for options in the database.
  `getType`() | Return the type of the linesearch.
  `setFromOptions`() | Configure the linesearch from the options database.
  `setGradient`(gradient[, args, kargs]) | Set the gradient evaluation callback.
  `setInitialStepLength`(s) | Sets the initial step length of a line search.
  `setObjective`(objective[, args, kargs]) | Set the objective function evaluation callback.
  `setObjectiveGradient`(objgrad[, args, kargs]) | Set the objective function and gradient evaluation callback.
  `setOptionsPrefix`([prefix]) | Set the prefix used for searching for options in the database.
  `setType`(ls_type) | Set the type of the linesearch.
  `setUp`() | Set up the internal data structures for using the linesearch.
  `useTAORoutine`(tao) | Use the objective and gradient evaluation routines from the given Tao object.
  `view`([viewer]) | View the linesearch object.

  Methods Documentation

  apply(x, g, s)

    Performs a line-search in a given step direction.

    Collective.

    See also

    `TaoLineSearchApply`

    Source code at petsc4py/PETSc/TAO.pyx:2459

    Parameters:

      - x (Vec)

      - g (Vec)

      - s (Vec)

    Return type:

      tuple[float, float, str]

  create(comm=None)

    Create a TAO linesearch.

    Collective.

    Parameters:

      comm – MPI communicator, defaults to `Sys.getDefaultComm`.

    Return type:

      Self

    See also

    `Sys.getDefaultComm`, `TaoLineSearchCreate`

    Source code at petsc4py/PETSc/TAO.pyx:2262

  destroy()

    Destroy the linesearch object.

    Collective.

    See also

    `TaoLineSearchDestroy`

    Source code at petsc4py/PETSc/TAO.pyx:2249

    Return type:

      Self

  getOptionsPrefix()

    Return the prefix used for searching for options in the database.

    Not collective.

    See also

    Working with PETSc options, `setOptionsPrefix`, `TaoLineSearchGetOptionsPrefix`

    Source code at petsc4py/PETSc/TAO.pyx:2354

    Return type:

      str

  getType()

    Return the type of the linesearch.

    Not collective.

    See also

    `setType`, `TaoLineSearchGetType`

    Source code at petsc4py/PETSc/TAO.pyx:2302

    Return type:

      str

  setFromOptions()

    Configure the linesearch from the options database.

    Collective.

    See also

    Working with PETSc options, `TaoLineSearchSetFromOptions`

    Source code at petsc4py/PETSc/TAO.pyx:2316

    Return type:

      None

  setGradient(gradient, args=None, kargs=None)

    Set the gradient evaluation callback.

    Logically collective.

    Parameters:

      - gradient (TAOLSGradientFunction) – The gradient callback.

      - g – The vector to store the gradient.

      - args (tuple[Any, ...] | None) – Positional arguments for the callback.

      - kargs (dict[str, Any] | None) – Keyword arguments for the callback.

    Return type:

      None

    See also

    `setObjective`, `setObjectiveGradient`, `setHessian`, `TaoLineSearchSetGradientRoutine`

    Source code at petsc4py/PETSc/TAO.pyx:2393

  setInitialStepLength(s)

    Sets the initial step length of a line search.

    Logically collective.

    See also

    `TaoLineSearchSetInitialStepLength`

    Source code at petsc4py/PETSc/TAO.pyx:2475

    Parameters:

      s (float)

    Return type:

      None

  setObjective(objective, args=None, kargs=None)

    Set the objective function evaluation callback.

    Logically collective.

    Parameters:

      - objective (TAOLSObjectiveFunction) – The objective function callback.

      - args (tuple[Any, ...] | None) – Positional arguments for the callback.

      - kargs (dict[str, Any] | None) – Keyword arguments for the callback.

    Return type:

      None

    See also

    `setGradient`, `setObjectiveGradient`, `TaoLineSearchSetObjectiveRoutine`

    Source code at petsc4py/PETSc/TAO.pyx:2368

  setObjectiveGradient(objgrad, args=None, kargs=None)

    Set the objective function and gradient evaluation callback.

    Logically collective.

    Parameters:

      - objgrad (TAOLSObjectiveGradientFunction) – The objective function and gradient callback.

      - g – The vector to store the gradient.

      - args (tuple[Any, ...] | None) – Positional arguments for the callback.

      - kargs (dict[str, Any] | None) – Keyword arguments for the callback.

    Return type:

      None

    See also

    `setObjective`, `setGradient`, `setHessian`, `getObjectiveAndGradient`, `TaoLineSearchSetObjectiveAndGradientRoutine`

    Source code at petsc4py/PETSc/TAO.pyx:2420

  setOptionsPrefix(prefix=None)

    Set the prefix used for searching for options in the database.

    Logically collective.

    See also

    Working with PETSc options, `TaoLineSearchSetOptionsPrefix`

    Source code at petsc4py/PETSc/TAO.pyx:2340

    Parameters:

      prefix (str | None)

    Return type:

      None

  setType(ls_type)

    Set the type of the linesearch.

    Logically collective.

    Parameters:

      ls_type (Type | str) – The type of the solver.

    Return type:

      None

    See also

    `getType`, `TaoLineSearchSetType`

    Source code at petsc4py/PETSc/TAO.pyx:2283

  setUp()

    Set up the internal data structures for using the linesearch.

    Collective.

    See also

    `TaoLineSearchSetUp`

    Source code at petsc4py/PETSc/TAO.pyx:2328

    Return type:

      None

  useTAORoutine(tao)

    Use the objective and gradient evaluation routines from the given Tao object.

    Logically collective.

    See also

    `TaoLineSearchUseTaoRoutines`

    Source code at petsc4py/PETSc/TAO.pyx:2447

    Parameters:

      tao (TAO)

    Return type:

      None

  view(viewer=None)

    View the linesearch object.

    Collective.

    Parameters:

      viewer (Viewer | None) – A `Viewer` instance or `None` for the default viewer.

    Return type:

      None

    See also

    `TaoLineSearchView`

    Source code at petsc4py/PETSc/TAO.pyx:2230

  __init__()
  classmethod __new__(*args, **kwargs)