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

Commit

Permalink
Format .jl files (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Sep 26, 2020
1 parent c5e2aea commit 517f68d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/instruct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ function _instruct!(
locs_raw::SVector,
ic::IterControl,
) where {T}
work = ndims(state) == 1 ? similar(state, length(locs_raw)) :
work =
ndims(state) == 1 ? similar(state, length(locs_raw)) :
similar(state, length(locs_raw), size(state, 2))
controldo(ic) do i
@inbounds unrows!(state, locs_raw .+ i, U, work)
Expand Down Expand Up @@ -302,7 +303,7 @@ end
import YaoBase: rot_mat

rot_mat(::Type{T}, ::Val{:Rx}, theta::Number) where {T} =
T[cos(theta / 2) -im * sin(theta / 2); -im * sin(theta / 2) cos(theta / 2)]
T[cos(theta / 2) -im*sin(theta / 2); -im*sin(theta / 2) cos(theta / 2)]
rot_mat(::Type{T}, ::Val{:Ry}, theta::Number) where {T} =
T[cos(theta / 2) -sin(theta / 2); sin(theta / 2) cos(theta / 2)]
rot_mat(::Type{T}, ::Val{:Rz}, theta::Number) where {T} =
Expand Down
6 changes: 4 additions & 2 deletions src/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ function rand_state(
nbatch::Int = 1,
no_transpose_storage::Bool = false,
) where {T}
raw = nbatch == 1 || no_transpose_storage ? randn(T, 1 << n, nbatch) :
raw =
nbatch == 1 || no_transpose_storage ? randn(T, 1 << n, nbatch) :
transpose(randn(T, nbatch, 1 << n))
return normalize!(ArrayReg{nbatch}(raw))
end
Expand Down Expand Up @@ -451,7 +452,8 @@ function uniform_state(
nbatch::Int = 1,
no_transpose_storage::Bool = false,
) where {T}
raw = nbatch == 1 || no_transpose_storage ? ones(T, 1 << n, nbatch) :
raw =
nbatch == 1 || no_transpose_storage ? ones(T, 1 << n, nbatch) :
transpose(ones(T, nbatch, 1 << n))
normalize!(ArrayReg{nbatch}(raw))
end
Expand Down

0 comments on commit 517f68d

Please sign in to comment.