diff --git a/docs/make.jl b/docs/make.jl index 6fe2646..8099777 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -3,7 +3,7 @@ include("DummyDocs.jl") using .DummyDocs makedocs( - sitename="BcdiCore.jl", + sitename="BcdiTrad.jl", format = Documenter.HTML( prettyurls = get(ENV, "CI", nothing) == "true" ), diff --git a/src/State.jl b/src/State.jl index 7db5281..a79d50e 100644 --- a/src/State.jl +++ b/src/State.jl @@ -6,7 +6,7 @@ indicating trusted intensities need to be passed in. """ struct State{T} realSpace::CuArray{ComplexF64, 3, CUDA.Mem.DeviceBuffer} - shift::Vector{Int64} + shift::Tuple{Int64,Int64,Int64} support::CuArray{Bool, 3, CUDA.Mem.DeviceBuffer} core::T @@ -18,20 +18,7 @@ struct State{T} function State(intens, recSupport, support) s = size(intens) - shift = [0.,0,0] - for i in 1:s[1] - for j in 1:s[2] - for k in 1:s[3] - shift[1] += i*sqrt(intens[i,j,k]) - shift[2] += j*sqrt(intens[i,j,k]) - shift[3] += k*sqrt(intens[i,j,k]) - end - end - end - shift .= [1,1,1] .- round.(Int64, shift ./ mapreduce(sqrt, +, intens)) - intens = CuArray{Float64, 3, CUDA.Mem.DeviceBuffer}(circshift(intens,shift)) - recSupport = CuArray{Float64, 3, CUDA.Mem.DeviceBuffer}(circshift(recSupport,shift)) - shift .*= -1 + intens, recSupport, shift = BcdiCore.centerPeak(intens, recSupport, "corner") realSpace = CUDA.zeros(ComplexF64, s) core = BcdiCore.TradState("L2", false, realSpace, intens, recSupport) @@ -39,5 +26,16 @@ struct State{T} new{typeof(core)}(realSpace, shift, support, core) end + + function State(intens, recSupport, support, core) + s = size(intens) + intens, recSupport, shift = BcdiCore.centerPeak(intens, recSupport, "corner") + + newCore = BcdiCore.TradState( + core.losstype, core.scale, intens, core.plan, + core.realSpace, recSupport, core.working, core.deriv + ) + new{typeof(newCore)}(core.realSpace, shift, support, newCore) + end end