Feat new gate#191
Conversation
…aket_observable and submit_job_braket functions
…into feat-New-gate
…into feat-New-gate
…hout verbatim box
…into feat-New-gate
…andle several translations, implemented cirq global phase
…e translation to cirq fixed
|
|
||
| def __repr__(self): | ||
| return f"{type(self).__name__}({self.theta}, {self.targets[0]})" | ||
| target = ", ".join(str(t) for t in self.targets) |
There was a problem hiding this comment.
| target = ", ".join(str(t) for t in self.targets) | |
| target = "[" + ", ".join(str(t) for t in self.targets) + "]" |
| from braket.circuits import Instruction | ||
|
|
||
| connection = self.targets | ||
| connection = [target for target in self.targets] |
There was a problem hiding this comment.
self.targets is not already a list ?
There was a problem hiding this comment.
Yes but I want to make a copy not just copy the values not the address.
| from braket.circuits import Instruction | ||
|
|
||
| connection = self.targets | ||
| connection = [target for target in self.targets] |
| rx = Rx(theta, self.targets[0]).to_matrix() | ||
| rz_minus = Rz(-phi, self.targets[0]).to_matrix() | ||
|
|
||
| return rz_plus @ rx @ rz_minus |
There was a problem hiding this comment.
can you just put the matrix ?
| def __init__(self, theta: Expr | float, target: int): | ||
| self.parameters = [theta] | ||
| def __init__( | ||
| self, theta: list[Expr | float] | Expr | float, target: list[int] | int |
There was a problem hiding this comment.
target -> targets
|
|
||
| @classproperty | ||
| def cirq_gate(cls): | ||
| pass |
| except: | ||
| pass | ||
|
|
||
| if language == Language.QISKIT: |
There was a problem hiding this comment.
put this in def {Language}_gate(cls):
|
|
||
| # Checks if all the gates or its direct decomposition are available on the device. | ||
| authorized_gates = device.compatible_gate() | ||
| if authorized_gates != set(): |
There was a problem hiding this comment.
| if authorized_gates != set(): | |
| if len(authorized_gates) > 0: |
| full_matrix, label=obs.label # pyright: ignore[reportArgumentType] | ||
| ) | ||
| ) | ||
| continue |
There was a problem hiding this comment.
Is it better to use “else” instead of “continue”?
| QCircuit([gate]).to_other_language(Language.QISKIT, authorized_gates=gate_set) | ||
|
|
||
|
|
||
| def define_parameters(decomposition: bool): |
There was a problem hiding this comment.
Handle testing for each providers
| ┌──────────┐ | ||
| q_0: ┤2 ├ | ||
| │ │ | ||
| q_1: ┤1 Unitary ├ | ||
| │ │ | ||
| q_2: ┤0 ├ | ||
| └──────────┘ |
There was a problem hiding this comment.
We lose here the info that the gate is controlled by qubit 0 and 2 in the print, do you think there is still a way to do it, or it is not a big loss ? Because from a conceptual MPQP point of view we mentioned explicitly (in the example) that it is a CustomControlledGate, so it is sad that it is handled after like a generic 3-qubit Unitary
Added native gates PRX and Rzz for IQM computers.
Also added the ComposedGate interface for future more complex gates.
Fixed adjust_measure for non continuous and partial observables.
Changed the overall translation from mpqp to Braket ==> stop padding the braket circuit with Id gates and accepting non continuous circuits. For the sake of more optimized hardware runs.
Also refactoring and future proofing.