-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linear function usability improvements (#10053)
* contructing linear functions from circuits with barriers and delays; adding __eq__ method * adding linear function extend_with_identity method * constructing linear functions from nested circuits * reorganizing code; constructing linear functions from cliffords (when possible) * tests for linear functions from cliffords * linear function from permutation gate * simplifying condition for checking whether clifford is a linear function * linear function from another * pass over release notes * black * pylint fixes * update docstring * more docstring fixes * adding pretty-printing functions for linear functions * adding pretty-printing functions to the release notes * adding pseudo-random tests * moving import to the top of the file * Fix to __eq__ as suggested in review --------- Co-authored-by: Shelly Garion <46566946+ShellyGarion@users.noreply.github.com>
- Loading branch information
1 parent
ae40b4c
commit 93feba7
Showing
3 changed files
with
456 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
releasenotes/notes/linear-functions-usability-45265f293a80a6e5.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
features: | ||
- | | ||
Allowing to construct a :class:`.LinearFunction` object from more general quantum circuits, | ||
that may contain: | ||
* Barriers (of type :class:`~qiskit.circuit.Barrier`) and delays (:class:`~qiskit.circuit.Delay`), | ||
which are simply ignored | ||
* Permutations (of type :class:`~qiskit.circuit.library.PermutationGate`) | ||
* Other linear functions | ||
* Cliffords (of type :class:`.Clifford`), when the Clifford represents a linear function | ||
(and a ``CircuitError`` exception is raised if not) | ||
* Nested quantum circuits of this form | ||
- | | ||
Added :meth:`.LinearFunction.__eq__` method. Two objects of type :class:`.LinearFunction` | ||
are considered equal when their representations as binary invertible matrices are equal. | ||
- | | ||
Added :meth:`.LinearFunction.extend_with_identity` method, which allows to extend | ||
a linear function over ``k`` qubits to a linear function over ``n >= k`` qubits, | ||
specifying the new positions of the original qubits and padding with identities on the | ||
remaining qubits. | ||
- | | ||
Added two methods for pretty-printing :class:`.LinearFunction` objects: | ||
:meth:`.LinearFunction.mat_str`, which returns the string representation of the linear | ||
function viewed as a matrix with 0/1 entries, and | ||
:meth:`.LinearFunction.function_str`, which returns the string representation of the | ||
linear function viewed as a linear transformation. |
Oops, something went wrong.