tlm_adjoint.adjoint
Module Contents
- class tlm_adjoint.adjoint.AdjointRHS(x)
Adjoint equation right-hand-side component.
The right-hand-side of an adjoint equation, for an adjoint variable associated with an operation computing a forward variable x.
- Parameters:
- xvariable
The forward variable.
- b(*, copy=False)
Access the adjoint right-hand-side.
- Parameters:
- copybool
Whether to return a copy of the right-hand-side.
- Returns:
- variable
The right-hand-side.
- sub(b)
Subtract a term from the adjoint right-hand-side.
- Parameters:
- bobject
The term to subtract.
See also
- class tlm_adjoint.adjoint.AdjointEquationRHS(eq)
Adjoint equation right-hand-side.
The right-hand-side of an adjoint equation, for adjoint variables associated with an operation computing multiple forward variables.
SequenceofAdjointRHSobjects.- Parameters:
- b(*, copy=False)
For the case where there is a single forward variable, return the associated adjoint right-hand-side.
- Parameters:
- copybool
Whether to return a copy of the right-hand-side.
- Returns:
- variable
The right-hand-side.
- B(*, copy=False)
Return adjoint right-hand-side components.
- Parameters:
- copybool
Whether to return copies of the right-hand-side components.
- Returns:
- tuple[variable, …]
The right-hand-side components.
- class tlm_adjoint.adjoint.AdjointBlockRHS(block)
Multiple adjoint equation right-hand-sides.
SequenceofAdjointEquationRHSobjects.- Parameters:
- pop()
Remove and return the last
AdjointEquationRHS. Decreases the length of thisAdjointBlockRHSby one.- Returns:
- int
The index of the removed
AdjointEquationRHS.AdjointEquationRHSThe removed
AdjointEquationRHS.
- is_empty()
Return whether this
AdjointBlockRHShas length zero.- Returns:
- bool
Whether this
AdjointBlockRHShas length zero.
- class tlm_adjoint.adjoint.AdjointModelRHS(blocks)
Multiple blocks of adjoint right-hand-sides.
MappingfrominttoAdjointBlockRHSobjects.- Parameters:
- blocksSequence[Sequence[
Equation, …], …] or Mapping[int, Sequence[Equation, …], …] The adjoint right-hand-sides are associated with the operations defined by these blocks of
Equationobjects. Any trailing emptyAdjointBlockRHSobjects are removed automatically.
- blocksSequence[Sequence[
- pop()
Remove and return the last
AdjointEquationRHSin the lastAdjointBlockRHSin thisAdjointModelRHS. Then remove any trailing emptyAdjointBlockRHSobjects.- Returns:
- (n, i)tuple[int, int]
The removed right-hand-side is associated with
Equationi in block n.AdjointEquationRHSThe removed
AdjointEquationRHS.
- is_empty()
Return whether this
AdjointModelRHShas length zero.- Returns:
- bool
Whether this
AdjointModelRHShas length zero.