From 517f68d586bf62a594558d122e1a7be01b0b1090 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 26 Sep 2020 12:00:27 -0400 Subject: [PATCH] Format .jl files (#69) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/instruct.jl | 5 +++-- src/register.jl | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/instruct.jl b/src/instruct.jl index 0aebf0f..07af57c 100644 --- a/src/instruct.jl +++ b/src/instruct.jl @@ -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) @@ -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} = diff --git a/src/register.jl b/src/register.jl index 21f67c4..2469b4a 100644 --- a/src/register.jl +++ b/src/register.jl @@ -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 @@ -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