QSimulator.jl icon indicating copy to clipboard operation
QSimulator.jl copied to clipboard

Julia v1.0 interpolation indexing

Open matthewware opened this issue 5 years ago • 2 comments

The microwave control logic maps waveform information to drive term amplitudes in https://github.com/BBN-Q/QSimulator.jl/blob/240fe357b39f9a8302ce5af08f3dad90343e8b07/src/controls.jl#L45 Issues pop up when the mapping from scaled time to sequence index is close to zero (Julia uses 1-based indexing). This issue could have arisen from the Interpolations.jl changes (note OnGrid() is gone). More investigation is needed.

matthewware avatar Apr 12 '19 15:04 matthewware

Minimal working example:

function run_simulation(sys, rhoIn, measOp, times)
    populations = zeros(length(times)-1)
    U = eye(ComplexF64, dim(sys))
    dt = 0.01
    rho = rhoIn
    for ct = 1:length(times)-1
        U = unitary_propagator(sys, dt, times[ct], times[ct+1])
        populations[ct] = real(tr(U*rho*U'*measOp))
        rho = U*rho*U'
    end
    return populations
end

times = 0.0:200.0
populations = run_simulation(sys, rhoIn, measOp, times);

matthewware avatar Apr 12 '19 15:04 matthewware

Seems like forcing amplitue to 0.0 on under and over runs is doing the trick. I'll probably merge into master soon.

matthewware avatar Apr 12 '19 22:04 matthewware