-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
In file nv.py classes ControlledRotXInstruction and ControlledRotYInstruction both use axis = [1, 0, 0] as the rotation axis.
It seems to me that ControlledRotYInstruction should use axis = [0, 1, 0] as the rotation axis.
Although this seems "obvious", I don't dare to make the change and issue a pull request, because ControlledRotYInstruction is used twice in transpile.py to implement NV operations _move_electron_carbon and _move_carbon_electron. If ControlledRotYInstruction was really wrong, surely those move operations would not work correctly?
@dataclass
class ControlledRotXInstruction(core.ControlledRotationInstruction):
id: int = 30
mnemonic: str = "crot_x"
def to_matrix(self) -> np.ndarray:
axis = [1, 0, 0]
angle = self.angle_num.value * np.pi / 2**self.angle_denom.value
return get_controlled_rotation_matrix(axis, angle)
def to_matrix_target_only(self) -> np.ndarray:
axis = [1, 0, 0]
angle = self.angle_num.value * np.pi / 2**self.angle_denom.value
return get_rotation_matrix(axis, angle)
@dataclass
class ControlledRotYInstruction(core.ControlledRotationInstruction):
id: int = 31
mnemonic: str = "crot_y"
def to_matrix(self) -> np.ndarray:
axis = [1, 0, 0]
angle = self.angle_num.value * np.pi / 2**self.angle_denom.value
return get_controlled_rotation_matrix(axis, angle)
def to_matrix_target_only(self) -> np.ndarray:
axis = [1, 0, 0]
angle = self.angle_num.value * np.pi / 2**self.angle_denom.value
return get_rotation_matrix(axis, angle)
Metadata
Metadata
Assignees
Labels
No labels