Skip to content
This repository was archived by the owner on Dec 18, 2021. It is now read-only.

Commit d443a6a

Browse files
Format .jl files (#146)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 67f5eb9 commit d443a6a

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/autodiff/adjroutines.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ function adjcunmat(
5858
adjunij!(adjy, locs_raw .+ i, adjU)
5959
end
6060

61-
adjU = all(diff([locs...]) .> 0) ? adjU :
61+
adjU =
62+
all(diff([locs...]) .> 0) ? adjU :
6263
YaoBase.reorder(adjU, collect(locs) |> sortperm |> sortperm)
6364
adjU
6465
end

src/primitive/rotation_gate.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ end
8888

8989
# Specialized
9090
mat(::Type{T}, R::RotationGate{1,<:Any,<:XGate}) where {T} =
91-
T[cos(R.theta / 2) -im * sin(R.theta / 2); -im * sin(R.theta / 2) cos(R.theta / 2)]
91+
T[cos(R.theta / 2) -im*sin(R.theta / 2); -im*sin(R.theta / 2) cos(R.theta / 2)]
9292
mat(::Type{T}, R::RotationGate{1,<:Any,<:YGate}) where {T} =
9393
T[cos(R.theta / 2) -sin(R.theta / 2); sin(R.theta / 2) cos(R.theta / 2)]
9494
# mat(R::RotationGate{1, T, ZGate{Complex{T}}}) where T =
@@ -130,4 +130,4 @@ function parameters_range!(out::Vector{Tuple{T,T}}, gate::RotationGate{N,T,GT})
130130
push!(out, (0.0, 2.0 * pi))
131131
end
132132

133-
occupied_locs(g::RotationGate) = occupied_locs(g.block)
133+
occupied_locs(g::RotationGate) = occupied_locs(g.block)

src/treeutils/load.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ function parse_ex(ex, info::ParseInfo)
7777
:($exloc => Measure => $post) => parse_ex(:($exloc => Measure(nothing) => $post), info)
7878
:($exloc => Measure($op) => $post) => begin
7979
locs = exloc == :ALL ? :(AllLocs()) : render_loc(exloc, info.nbit)
80-
op = op isa Nothing || op == :nothing ? :(ComputationalBasis()) :
81-
parse_ex(op, exloc == :ALL ? info : ParseInfo(length(locs), info.version))
80+
op =
81+
op isa Nothing || op == :nothing ? :(ComputationalBasis()) :
82+
parse_ex(op, exloc == :ALL ? info : ParseInfo(length(locs), info.version))
8283
@match post begin
8384
::Nothing || :nothing => :(Measure($(info.nbit); locs = $locs, operator = $(op)))
8485
:(resetto($(rbits...))) => begin

test/primitive/rotation_gate.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313
@testset "test matrix" begin
1414
theta = 2.0
1515
for (DIRECTION, MAT) in [
16-
(X, [cos(theta / 2) -im * sin(theta / 2); -im * sin(theta / 2) cos(theta / 2)]),
16+
(X, [cos(theta / 2) -im*sin(theta / 2); -im*sin(theta / 2) cos(theta / 2)]),
1717
(Y, [cos(theta / 2) -sin(theta / 2); sin(theta / 2) cos(theta / 2)]),
1818
(Z, [exp(-im * theta / 2) 0; 0 exp(im * theta / 2)]),
1919
(CNOT, exp(-mat(CNOT) / 2 * theta * im |> Matrix)),
@@ -60,6 +60,6 @@ end
6060
end
6161

6262
@testset "occupied locs" begin
63-
g = rot(put(5, 2=>X), 0.5)
63+
g = rot(put(5, 2 => X), 0.5)
6464
@test occupied_locs(g) == (2,)
65-
end
65+
end

0 commit comments

Comments
 (0)