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)\).
- static get_generators_symbol2irrep_dict(groupname)¶
Retrieve a dictionary which maps the symbols from the provided group to characters of the group generators.
- static get_irrep2symbol_dict(group)¶
Retrieve a dictionary which maps the characters of an irrep to the symbol from the character table.
- static get_supported_point_group_dict()¶
Returns a dictionary yielding all supported point group information, with point group labels as keys.
- static get_symbol2irrep_dict(groupname)¶
Retrieve a dictionary which maps the irrep symbols from the provided group to the 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 inirrep_labels
. Generators which are redundant after removal of irreps not in irrep_labels are removed.
- static supported_groups()¶
Return a
list
of point groups supported by thePointGroup
object.- Return type:
- 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 alist
ofSymmetryOperatorPauli
s and a symmetry sector as a list of scalars. Key methods here aretapered_operator()
which tapers an operator for a provided set of symmetry operators and sectors, andtapered_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 withfind_x_operators()
andtapering_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 toTrue
to skip attempting to find single qubit \(X\) operators. Defaults toFalse
.
- 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 indexi
in the returned list will anticommute with the symmetry operator of indexi
contained in this instance, and will commute with all other symmetry operators. For efficiency, generated \(X\) operators are cached in theTapererZ2
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 settingskip_minimal=True
. To fail in case of failure of the first method, catchBruteForcingXOperatorWarning
and except.- Parameters:
skip_minimal (
bool
, default:False
) – Set toTrue
to skip attempting to find single qubit \(X\) operators.regenerate (
bool
, default:False
) – Set toTrue
to ignore cached x operators and recalculate. Note that if stored \(X\) operators are derived from a different setting ofskip_minimal
, operators will be regenerated regardless of this setting.cache_on_regenerate (
bool
, default:True
) – If set, cachedX
operators will be overwritten ifX
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
) – IfTrue
, 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 equivalentQubitState
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 toTrue
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
andcache_on_regenerate
parameters. The optionalx_operators
is alist
ofQubitOperatorString
objects including only \(X\) or \(I\), in which the element with indexi
will anticommute with the symmetry operator of indexi
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 toTrue
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 toTrue
to skip attempting to find single qubit X operators. Defaults toFalse
.x_operators (
Union
[list
[QubitOperatorString
],list
[SymmetryOperatorPauli
],None
], default:None
) – For advanced usage, alist
of operators including only \(X\) operators used to form the tapering unitary may be provided. IfNone
(the default), cached \(X\) operators will be used.
- Returns:
QubitOperator
– The Clifford tapering unitary.