tequila.optimizers.optimizer_phoenics.OptimizerPhoenics.compile_gradient

OptimizerPhoenics.compile_gradient(objective: tequila.objective.objective.Objective, variables: List[tequila.objective.objective.Variable], gradient=None, *args, **kwargs) → Tuple[Dict, Dict]

Convenience function to compile gradient objects and relavant types. For use by inheritors.

Convenience: build and compile (i.e render callable) the gradient of an objective.

Parameters
  • objective (Objective:) – the objective whose gradient is to be calculated.

  • variables (list:) – the variables to take gradients with resepct to.

  • gradient – special argument to change what structure is used to calculate the gradient, like numerical, or QNG. Default: use regular, analytic gradients.

  • optional – special argument to change what structure is used to calculate the gradient, like numerical, or QNG. Default: use regular, analytic gradients.

  • args

  • kwargs

Returns

both the uncompiled and compiled gradients of objective, w.r.t variables.

Return type

tuple