Methods to calculate the CTRMG env and expectation value along with the gradient (varipeps.optimization.inner_function)

varipeps.optimization.inner_function.calc_ctmrg_expectation(input_tensors: Sequence[Array], unitcell: PEPS_Unit_Cell, expectation_func: Expectation_Model, convert_to_unitcell_func: Map_To_PEPS_Model | None, additional_input: Dict[str, Array] = {}, *, enforce_elementwise_convergence: bool | None = None) Tuple[Array, PEPS_Unit_Cell]

Calculate the CTMRG environment and the (energy) expectation value for a iPEPS unitcell.

Parameters:
  • input_tensors (sequence of jax.numpy.ndarray) – Sequence of the tensors the unitcell consists of.

  • unitcell (PEPS_Unit_Cell) – The PEPS unitcell to work on.

  • expectation_func (Expectation_Model) – Callable to calculate the expectation value.

  • convert_to_unitcell_func (Map_To_PEPS_Model) – Function to convert the input_tensors to a PEPS unitcell. If ommited, it is assumed that a PEPS unitcell is the input.

  • additional_input (dict of str to jax.numpy.ndarray mapping, optional) – Optional dict with additional inputs which should be considered in the calculation of the expectation value.

    Default: {}

Keyword Arguments:

(obj (enforce_elementwise_convergence) – bool): Enforce elementwise convergence of the CTM tensors instead of only convergence of the singular values of the corners.

Returns:

Tuple consisting of the calculated expectation value and the new unitcell.

Return type:

tuple(jax.numpy.ndarray, PEPS_Unit_Cell)

varipeps.optimization.inner_function.calc_ctmrg_expectation_custom(input_tensors: Sequence[Array], unitcell: PEPS_Unit_Cell, expectation_func: Expectation_Model, convert_to_unitcell_func: Map_To_PEPS_Model | None, additional_input: Dict[str, Array] = {}) Tuple[Array, PEPS_Unit_Cell]

Calculate the CTMRG environment and the (energy) expectation value for a iPEPS unitcell using the custom VJP rule implementation.

Parameters:
  • input_tensors (sequence of jax.numpy.ndarray) – Sequence of the tensors the unitcell consists of.

  • unitcell (PEPS_Unit_Cell) – The PEPS unitcell to work on.

  • expectation_func (Expectation_Model) – Callable to calculate the expectation value.

  • convert_to_unitcell_func (Map_To_PEPS_Model) – Function to convert the input_tensors to a PEPS unitcell. If ommited, it is assumed that a PEPS unitcell is the input.

  • additional_input (dict of str to jax.numpy.ndarray mapping, optional) – Dict with additional inputs which should be considered in the calculation of the expectation value.

    Default: {}

Returns:

Tuple consisting of the calculated expectation value and the new unitcell.

Return type:

tuple(jax.numpy.ndarray, PEPS_Unit_Cell)

varipeps.optimization.inner_function.calc_ctmrg_expectation_custom_value_and_grad(input_tensors: Sequence[Array], unitcell: PEPS_Unit_Cell, expectation_func: Expectation_Model, convert_to_unitcell_func: Map_To_PEPS_Model | None, additional_input: Dict[str, Array] = {}) Tuple[Array, PEPS_Unit_Cell]

Value and gradient of calc_ctmrg_expectation_custom with respect to positional argument(s) 0. Takes the same arguments as calc_ctmrg_expectation_custom but returns a two-element tuple where the first element is the value of calc_ctmrg_expectation_custom and the second element is the gradient, which has the same shape as the arguments at positions 0.

varipeps.optimization.inner_function.calc_ctmrg_expectation_value_and_grad(input_tensors: Sequence[Array], unitcell: PEPS_Unit_Cell, expectation_func: Expectation_Model, convert_to_unitcell_func: Map_To_PEPS_Model | None, additional_input: Dict[str, Array] = {}, *, enforce_elementwise_convergence: bool | None = None) Tuple[Array, PEPS_Unit_Cell]

Value and gradient of calc_ctmrg_expectation with respect to positional argument(s) 0. Takes the same arguments as calc_ctmrg_expectation but returns a two-element tuple where the first element is the value of calc_ctmrg_expectation and the second element is the gradient, which has the same shape as the arguments at positions 0.

varipeps.optimization.inner_function.calc_preconverged_ctmrg_value_and_grad(input_tensors: Sequence[Array], unitcell: PEPS_Unit_Cell, expectation_func: Expectation_Model, convert_to_unitcell_func: Map_To_PEPS_Model | None, additional_input: Dict[str, Array] = {}, *, calc_preconverged: bool = True) Tuple[Tuple[Array, PEPS_Unit_Cell], Sequence[Array]]

Calculate the CTMRG environment and the (energy) expectation value as well as the gradient of this steps for a iPEPS unitcell.

To reduce the memory footprint of the automatic differentiation this function first calculates only the CTMRG env without the gradient for a less strict convergence and then calculates the gradient for the remaining CTMRG steps.

Parameters:
  • input_tensors (sequence of jax.numpy.ndarray) – Sequence of the tensors the unitcell consists of.

  • unitcell (PEPS_Unit_Cell) – The PEPS unitcell to work on.

  • expectation_func (Expectation_Model) – Callable to calculate the expectation value.

  • convert_to_unitcell_func (Map_To_PEPS_Model) – Function to convert the input_tensors to a PEPS unitcell. If ommited, it is assumed that a PEPS unitcell is the input.

  • additional_input (dict of str to jax.numpy.ndarray mapping, optional) – Optional dict with additional inputs which should be considered in the calculation of the expectation value.

    Default: {}

Keyword Arguments:

calc_preconverged (bool, optional) – Flag if the above described procedure to calculate a pre-converged environment should be used.

Default: True

Returns:

Tuple with two element: 1. Tuple consisting of the calculated expectation value and the new unitcell. 2. The calculated gradient.

Return type:

tuple(tuple(jax.numpy.ndarray, PEPS_Unit_Cell), tuple(jax.numpy.ndarray))