Skip to content

Commit

Permalink
Change .ravel() to .flatten() for gates
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Mar 28, 2022
1 parent d3ff74e commit f7afbec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/qibojit/custom_operators/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def one_qubit_base(self, state, nqubits, target, kernel, gate, qubits=None):
if kernel in ("apply_x", "apply_y", "apply_z"):
args = (state, tk, m)
else:
args = (state, tk, m, self.cast(gate, dtype=state.dtype).ravel())
args = (state, tk, m, self.cast(gate, dtype=state.dtype).flatten())

ktype = self.get_kernel_type(state)
if ncontrols:
Expand Down Expand Up @@ -366,7 +366,7 @@ def two_qubit_base(self, state, nqubits, target1, target2, kernel, gate, qubits=
if kernel == "apply_swap":
args = (state, tk1, tk2, m1, m2, uk1, uk2)
else:
args = (state, tk1, tk2, m1, m2, uk1, uk2, self.cast(gate).ravel())
args = (state, tk1, tk2, m1, m2, uk1, uk2, self.cast(gate).flatten())
assert state.dtype == args[-1].dtype

ktype = self.get_kernel_type(state)
Expand All @@ -384,7 +384,7 @@ def two_qubit_base(self, state, nqubits, target1, target2, kernel, gate, qubits=
def multi_qubit_base(self, state, nqubits, targets, gate, qubits=None):
assert gate is not None
state = self.cast(state)
gate = self.cast(gate.ravel())
gate = self.cast(gate.flatten())
assert state.dtype == gate.dtype

ntargets = len(targets)
Expand Down

0 comments on commit f7afbec

Please sign in to comment.