inquanto.symmetry

Module for point-group symmetry analysis.

class PointGroup(point_group)

Bases: object

Point group class with associated symmetry processing methods.

Parameters:

point_group (str) – The point group label as a string - e.g. "C2v".

compute_representation_components(representation)

Finds the combination of irreps which gives the provided representation.

This uses the reduction formula: \(n_{row} = \frac{1}{h} * (\sum_N \chi_R \chi_I)\).

Parameters:

representation (Union[list[int], ndarray]) – Representation to be reduced.

Returns:

list[tuple[int, str]] – Within each tuple, the first element is the coefficient of each irrep in the input representation, and the second element is the irrep symbol.

static get_generators_symbol2irrep_dict(groupname)

Retrieve a dictionary which maps the symbols from the provided group to characters of the group generators.

Parameters:

groupname (str) – Name of point group of interest.

Returns:

dict[str, Union[tuple[str, ...], tuple[int, ...], int, str]] – Dict whose keys are irrep symbols and whose values are irrep characters.

static get_irrep2symbol_dict(group)

Retrieve a dictionary which maps the characters of an irrep to the symbol from the character table.

Parameters:

group (str) – Name of point group of interest.

Returns:

dict[Union[tuple[str, ...], tuple[int, ...], int, str], str] – Dictionary whose keys are irrep characters and whose values are irrep symbols.

static get_supported_point_group_dict()

Returns a dictionary yielding all supported point group information, with point group labels as keys.

Returns:

dict[str, dict[str, Union[tuple[str, ...], tuple[int, ...], int, str]]] – A dictionary with point group labels as keys ("C2v" etc.). Corresponding values are dictionaries containing information regarding the point group (e.g. character table, symmetry element labels).

static get_symbol2irrep_dict(groupname)

Retrieve a dictionary which maps the irrep symbols from the provided group to the characters.

Parameters:

groupname (str) – Name of point group of interest.

Returns:

dict[str, Union[tuple[str, ...], tuple[int, ...], int, str]] – Dictionary whose keys are irrep symbols and whose values are irrep characters.

irrep_direct_product(irreps)

Computes the direct product of the irrep symbols given in irreps.

Parameters:

irreps (list[str]) – Iterable containing irrep symbols which belong to the PointGroup object’s group.

Returns:

tuple[list[tuple[int, str]], ndarray] – A tuple where the first element is a list of tuples containing the irrep coefficients and symbols. The second element is the direct product in terms of its characters.

classmethod mini_character_table(point_group_label, irrep_labels)

For a given point group, return a reduced form of the character table.

This includes only generators of the point_group_label point group and the irreps present in irrep_labels. Generators which are redundant after removal of irreps not in irrep_labels are removed.

Parameters:
  • point_group_label (str) – Label of the point group.

  • irrep_labels (list[str]) – List of irreducible representation labels.

Returns:

dict[str, tuple[int, ...]] – A map of irrep labels to characters.

print_character_table()

Pretty print the underlying character table.

Return type:

None

static supported_groups()

Return a list of point groups supported by the PointGroup object.

Return type:

list

class TapererZ2(symmetry_operators, symmetry_sectors, skip_fast_find_x_operators=False)

Bases: object

Performs \(\mathbb{Z}_2\) symmetry qubit tapering.

The procedure followed is as described by Bravyi et al. (arXiv:1701.08213 [quant-ph]). This technique uses \(\mathbb{Z}_2\) symmetries to reduce qubit requirements for the simulation of a given operator. A TapererZ2 object is instantiated by specifying Pauli symmetry operators as a list of SymmetryOperatorPaulis and a symmetry sector as a list of scalars. Key methods here are tapered_operator() which tapers an operator for a provided set of symmetry operators and sectors, and tapered_state() which finds a state within the tapered space corresponding to an input state. Note that tapering unitaries and \(X\) operators are generated upon instantiation and cached. For advanced usage, these may be manually regenerated with find_x_operators() and tapering_unitary().

Parameters:
  • symmetry_operators (list[SymmetryOperatorPauli]) – A list of \(\mathbb{Z}_2\) symmetry operators. Validity is not checked.

  • symmetry_sectors (list[Union[complex, float, int]]) – Expectation values of each provided symmetry operator for some reference state.

  • skip_fast_find_x_operators (bool, default: False) – In advanced usage, set to True to skip attempting to find single qubit \(X\) operators. Defaults to False.

symmetry_operators

\(\mathbb{Z}_2\) symmetry operators for which to use tapering.

symmetry_sectors

Symmetry sectors for which to use tapering.

taperable_qubits

The qubits which can be removed when tapering an operator or state.

exception XOperatorMinimalError

Bases: Exception

Raised if a valid set of single qubit \(X\) operators is requested, but cannot be found.

find_x_operators(skip_minimal=False, regenerate=False, cache_on_regenerate=True)

Find a list of \(X\) operators for generating tapering unitaries.

The key equation in this procedure is arXiv:1701.08213 [quant-ph] eq. 61. Generated operators include exclusively \(X\) or \(I\). The QubitOperatorString with index i in the returned list will anticommute with the symmetry operator of index i contained in this instance, and will commute with all other symmetry operators. For efficiency, generated \(X\) operators are cached in the TapererZ2 object. With default parameters, this will retrieve the cached operators if possible.

If possible, this method will attempt to find single qubit \(X\) operators that fulfil the above criteria. This should work with minimal symmetry operators e.g. from SymmetryZ2Qubit, but not necessarily in all cases e.g. if derived from fermionic symmetries. If this fails, it currently resorts to brute force, which will be exponentially expensive in the number of symmetry operators. Brute force search can be forced by setting skip_minimal=True. To fail in case of failure of the first method, catch BruteForcingXOperatorWarning and except.

Parameters:
  • skip_minimal (bool, default: False) – Set to True to skip attempting to find single qubit \(X\) operators.

  • regenerate (bool, default: False) – Set to True to ignore cached x operators and recalculate. Note that if stored \(X\) operators are derived from a different setting of skip_minimal, operators will be regenerated regardless of this setting.

  • cache_on_regenerate (bool, default: True) – If set, cached X operators will be overwritten if X operators are regenerated.

Returns:

tuple[list[QubitOperatorString], bool] – Operators including only \(X\) operators used to form the tapering unitary and a boolean, indicating whether single qubit \(X\) operators were calculated.

tapered_operator(qubit_operator, relabel_qubits=False, taperable_qubits=None)

Given a QubitOperator, find its tapered form.

The tapered operator is as described by Bravyi, Gambetta, Mezzacapo & Temme (arXiv:1701.08213 [quant-ph]), with the strings of Pauli \(X\) operators on the taperable qubits replaced by calculated known expectation values. For \(N\) independent symmetries (and expectation values) provided, \(N\) qubits should be removed.

Parameters:
  • qubit_operator (QubitOperator) – The operator to be tapered.

  • relabel_qubits (bool, default: False) – If True, qubits will be relabelled according to indices of the tapered qubits (e.g. if qubit 1 is tapered, qubit 2 goes to qubit 1, qubit 3 to qubit 2 and so on).

  • taperable_qubits (Optional[Iterable[Qubit]], default: None) – For advanced usage - specify an explicit iterable of qubits to be tapered rather than using cached taperable qubits determined from the symmetry operators. Validity is not checked - this may lead to unexpected results.

Returns:

QubitOperator – The tapered operator.

tapered_state(state, relabel_qubits=False)

Given a QubitState, find the equivalent QubitState within the tapered space.

This is performed by transforming the state with the tapering unitary and then contracting over the tapered qubits. For \(N\) independent symmetries (and expectation values) provided, \(N\) qubits should be removed.

Parameters:
  • state (QubitState) – The original state in the untapered space.

  • relabel_qubits (bool, default: False) – Set to True to relabel all qubits by decreasing index according to number of qubits removed.

Returns:

QubitState – The tapered state.

tapering_unitary(regenerate=False, cache_on_regenerate=True, skip_fast_find_x_operators=False, x_operators=None)

Return the unitary \(U\) which transforms an operator to perform qubit tapering.

For an operator with \(N\) independent \(\mathbb{Z}_2\) symmetries, this transforms the operator to an operator with only Pauli \(X\) or \(I\) acting on a set of \(N\) qubits - i.e. \(U\) in section VIII of arXiv:1701.08213 [quant-ph]. By default settings, this will be returned from cache - but this behaviour can be controlled with the regenerate and cache_on_regenerate parameters. The optional x_operators is a list of QubitOperatorString objects including only \(X\) or \(I\), in which the element with index i will anticommute with the symmetry operator of index i contained in this instance, and will commute with all other symmetry operators. By default, this is also retrieved from the cache.

Note that \(U\) is Clifford but may not be returned in an efficiently described form.

Parameters:
  • regenerate (bool, default: False) – Set to True to ignore cached unitary and recalculate.

  • cache_on_regenerate (bool, default: True) – If set, cached unitary will be overwritten if unitary is regenerated.

  • skip_fast_find_x_operators (bool, default: False) – Set to True to skip attempting to find single qubit X operators. Defaults to False.

  • x_operators (Union[list[QubitOperatorString], list[SymmetryOperatorPauli], None], default: None) – For advanced usage, a list of operators including only \(X\) operators used to form the tapering unitary may be provided. If None (the default), cached \(X\) operators will be used.

Returns:

QubitOperator – The Clifford tapering unitary.