Skip to content

Commit

Permalink
Merge pull request #122 from BoxiLi/new_black_version
Browse files Browse the repository at this point in the history
Adapt the code for the new stable version of black style
  • Loading branch information
BoxiLi committed Feb 8, 2022
2 parents 7679f41 + 8008175 commit 6f81971
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/qutip_qip/algorithms/qft.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def qft(N=1):
if N < 1:
raise ValueError("Minimum value of N can be 1")

N2 = 2 ** N
N2 = 2**N
phase = 2.0j * np.pi / N2
arr = np.arange(N2)
L, M = np.meshgrid(arr, arr)
Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,7 @@ def initialize(self, state=None, cbits=None, measure_results=None):
self.state = None

if state is not None:
if state.shape[0] != 2 ** self.qc.N:
if state.shape[0] != 2**self.qc.N:
raise ValueError("dimension of state is incorrect")
if self.mode == "density_matrix_simulator" and state.isket:
self.state = ket2dm(state)
Expand Down
6 changes: 3 additions & 3 deletions src/qutip_qip/compiler/circuitqedcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def _normalized_gauss_pulse(self):
td = 2.4384880692912567
sigma = 1 / 6 * td # 3 sigma
tlist = np.linspace(0, td, 1000)
max_pulse = 1 - np.exp(-((0 - td / 2) ** 2) / 2 / sigma ** 2)
max_pulse = 1 - np.exp(-((0 - td / 2) ** 2) / 2 / sigma**2)
coeff = (
np.exp(-((tlist - td / 2) ** 2) / 2 / sigma ** 2)
- np.exp(-((0 - td / 2) ** 2) / 2 / sigma ** 2)
np.exp(-((tlist - td / 2) ** 2) / 2 / sigma**2)
- np.exp(-((0 - td / 2) ** 2) / 2 / sigma**2)
) / max_pulse
return tlist, coeff

Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/device/circuitqed.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _set_up_drift(self):
destroy_op = destroy(self.dims[m])
coeff = 2 * np.pi * self.params["alpha"][m] / 2.0
self._drift.append(
(coeff * destroy_op.dag() ** 2 * destroy_op ** 2, [m])
(coeff * destroy_op.dag() ** 2 * destroy_op**2, [m])
)

@property
Expand Down
4 changes: 2 additions & 2 deletions src/qutip_qip/operations/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ def globalphase(theta, N=1):
"""
data = np.exp(1.0j * theta) * sp.eye(
2 ** N, 2 ** N, dtype=complex, format="csr"
2**N, 2**N, dtype=complex, format="csr"
)
return Qobj(data, dims=[[2] * N, [2] * N])

Expand Down Expand Up @@ -1706,7 +1706,7 @@ def qubit_clifford_group(N=None, target=0):

X = sigmax()
S = phasegate(np.pi / 2)
E = H * (S ** 3) * w ** 3
E = H * (S**3) * w**3

for op in map(
partial(reduce, mul),
Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/qubits.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def qubit_states(N=1, states=[0]):

return tensor(
[
alpha * basis(2, 1) + sqrt(1 - alpha ** 2) * basis(2, 0)
alpha * basis(2, 1) + sqrt(1 - alpha**2) * basis(2, 0)
for alpha in state_list
]
)

0 comments on commit 6f81971

Please sign in to comment.