- Refactored quick.primitives.#63
Merged
ACE07-Sev merged 12 commits into0.0.0-releasefrom Oct 18, 2025
Merged
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 0.0.0-release #63 +/- ##
=================================================
+ Coverage 89.49% 89.95% +0.46%
=================================================
Files 63 63
Lines 4387 4362 -25
=================================================
- Hits 3926 3924 -2
+ Misses 461 438 -23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
….Statevector`. - Given `quick.metrics.calculate_entanglement_entropy_slope()` uses only statevectors, the code migrates from `qiskit.quantum_info.partial_trace()` to native `quick.primitives.Statevector.partial_trace()`. - Added testers for new functionality.
…d `quick.primitives.Operator`. - Added `__matmul__` dunder to `quick.primitives.Operator`. - Updated `quick.primitives` testers.
…evector. - Added testers for the recent additions to primitives. - Fixed a bug with `quick.synthesis.unitarypreparation.ShannonDecomposition` with the `QUBIT_KEYS` missing some keys causing IndexError.
- Modified `get_counts` for `quick.circuit.PennylaneCircuit` to account for the version difference functionality.
- Updated `.decompose()` of `quick.circuit.Circuit` for better clarity and performance. - Fixed a bug with `.control()` in `quick.circuit.Circuit` where gates that do not have C, MC- methods available now get decomposed before being converted to controlled format. - Deprecated `quick.circuit.gate_matrix.Gate`, which will be brought back properly in quick's rewrite. - Added `.control()` to `quick.primitives.Operator` for calculating the controlled unitary of a unitary. - Brought `Scalar` back to `__mul__` for `quick.primitives.Operator` and `quick.primitives.Statevector` to act as global phase. - Added testers for the additions.
- Added constructor from general matrix to `quick.primitives.Operator` via using SVD.
- Slightly updated two qubit decomposition. - Added new test cases for weyl coordinates.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactored
quick.primitivesfor less code bloat and clarity. This consisted of deprecatingquick.primitives.Braandquick.primitives.Ketand creating a new primitive class calledquick.primitives.Statevector.quick.primitives.Brain specific will not be supported due to incompatibility of its compilation to statevectors, and by extension infeasibility of its original purpose which was to compile Bra-Ket expressions (inner-products, outer products, etc.) to circuits.This PR aims to provide clear purpose for
quick.primitives. Primitives are conventionally used in three main manners:1) Classical simulation of circuits to extract statevectors/unitaries: This task is done via circuit frameworks and
quick.backendand thus we avoid redoing this feature in primitives to comply with python zen, specifically "There should be one-- and preferably only one --obvious way to do it.", meaning any and all executions of the circuit are to be done only via backends or default backends present in the circuit frameworks.2) Datatype representation to annotate a variable as a Statevector/Operator: This was the way
quick.primitivesoperated mainly, which leads to code smell and incoherent usage of such dataclass andNDArrayfrom numpy. We avoid this, and only use primitives where their functionality as described in (3) are needed.3) Containing primitive specific functionality for reusability: Normalization, padding, etc. are functionality that are widely utilized with such entities, and thus the main focus of
quick.primitivesnow is to provide a class that contains such functionality for ease of use. That means users do not need to usequick.primitivesif they do not use such functionality and can simply useNDArraywithquick.predicatesto ensure a numpy array satisfies their requirements.This PR is first of many to align with the improved, rot-free development pattern in mind.