Skip to content

Feat new gate#191

Open
MathieuG-Colibri wants to merge 50 commits into
devfrom
feat-New-gate
Open

Feat new gate#191
MathieuG-Colibri wants to merge 50 commits into
devfrom
feat-New-gate

Conversation

@MathieuG-Colibri
Copy link
Copy Markdown
Collaborator

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.

JulienCalistoTD and others added 30 commits February 18, 2026 16:06
…aket_observable and submit_job_braket functions
@github-actions github-actions Bot added documentation Improvements or additions to documentation maintenance enhancement New feature or request labels Apr 21, 2026
@MathieuG-Colibri MathieuG-Colibri marked this pull request as ready for review April 21, 2026 15:32
@MathieuG-Colibri MathieuG-Colibri self-assigned this Apr 22, 2026
@MathieuG-Colibri MathieuG-Colibri marked this pull request as draft April 22, 2026 08:01
@MathieuG-Colibri MathieuG-Colibri marked this pull request as ready for review April 22, 2026 08:04
@github-actions github-actions Bot removed documentation Improvements or additions to documentation maintenance labels Apr 23, 2026

def __repr__(self):
return f"{type(self).__name__}({self.theta}, {self.targets[0]})"
target = ", ".join(str(t) for t in self.targets)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.targets is not already a list ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

rx = Rx(theta, self.targets[0]).to_matrix()
rz_minus = Rz(-phi, self.targets[0]).to_matrix()

return rz_plus @ rx @ rz_minus
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target -> targets


@classproperty
def cirq_gate(cls):
pass
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raises an error

except:
pass

if language == Language.QISKIT:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put this in def {Language}_gate(cls):

Comment thread mpqp/core/circuit.py

# Checks if all the gates or its direct decomposition are available on the device.
authorized_gates = device.compatible_gate()
if authorized_gates != set():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if authorized_gates != set():
if len(authorized_gates) > 0:

Comment thread mpqp/execution/runner.py
full_matrix, label=obs.label # pyright: ignore[reportArgumentType]
)
)
continue
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle testing for each providers

Comment on lines +37 to +43
┌──────────┐
q_0: ┤2 ├
│ │
q_1: ┤1 Unitary ├
│ │
q_2: ┤0 ├
└──────────┘
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants