Benchmarks added. JC and qho. #20

Merged
merged 1 commit into from Jul 26, 2015

Conversation

Projects
None yet
2 participants
@amitjamadagni
Member

amitjamadagni commented Jul 25, 2015

I hope we could have this in the master. I will shortly link the PR to the notebooks so that we could have a reference of the results.

Performance on

  • Jaynes-Cummings Model
  • Quantum Harmonic Oscillator
pref/qho.jl
+
+type SampleProc{Alg} <: Proc end
+
+type Qexpmv end

This comment has been minimized.

@acroy

acroy Jul 25, 2015

Contributor

Can't you use QuDynamics.QuExpmV directly for Alg? That should simplify things a bit.

@acroy

acroy Jul 25, 2015

Contributor

Can't you use QuDynamics.QuExpmV directly for Alg? That should simplify things a bit.

This comment has been minimized.

@amitjamadagni

amitjamadagni Jul 25, 2015

Member

@acroy sorry but I could not understand the construct ... In the example here the Op is passed as an parameter, so I thought of doing it this way ...

Also I tried something on these lines

type QuExpmV end

function operator_set(p::SampleProc, cfg::HarmonicOscillator)
    a = lowerop(cfg.N)
    hamiltonian = a'*a + cfg.lambda*(a + a')
    init_state = complex(statevec(1,FiniteBasis(cfg.N)))
    return full(hamiltonian), init_state, a+a'
end


function Base.run{Alg}(p::SampleProc{Alg}, cfg::HarmonicOscillator, s::(QuBase.QuArray, QuBase.QuArray, QuBase.QuArray))
    qprop = QuPropagator(s[1], s[2], cfg.tlist, Alg())
    for (t, psi) in qprop
        psi'*s[3]*psi
    end
end

procs = Proc[ SampleProc{QuExpmV}()]

and then running with the cfgs I end with an error which says there is no method matching the construct QuPropagator

Benchmarking quexpmv ...
ERROR: `QuPropagator{QPM<:QuPropagatorMethod,QVM<:Union(AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,2},AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,1}),QE<:QuEquation}` has no method matching QuPropagator{QPM<:QuPropagatorMethod,QVM<:Union(AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,2},AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,1}),QE<:QuEquation}(::QuArray{FiniteBasis{Orthonormal},Float64,2,Array{Float64,2}}, ::QuArray{FiniteBasis{Orthonormal},Complex{Float64},1,Array{Complex{Float64},1}}, ::FloatRange{Float64}, ::QuExpmV)
@amitjamadagni

amitjamadagni Jul 25, 2015

Member

@acroy sorry but I could not understand the construct ... In the example here the Op is passed as an parameter, so I thought of doing it this way ...

Also I tried something on these lines

type QuExpmV end

function operator_set(p::SampleProc, cfg::HarmonicOscillator)
    a = lowerop(cfg.N)
    hamiltonian = a'*a + cfg.lambda*(a + a')
    init_state = complex(statevec(1,FiniteBasis(cfg.N)))
    return full(hamiltonian), init_state, a+a'
end


function Base.run{Alg}(p::SampleProc{Alg}, cfg::HarmonicOscillator, s::(QuBase.QuArray, QuBase.QuArray, QuBase.QuArray))
    qprop = QuPropagator(s[1], s[2], cfg.tlist, Alg())
    for (t, psi) in qprop
        psi'*s[3]*psi
    end
end

procs = Proc[ SampleProc{QuExpmV}()]

and then running with the cfgs I end with an error which says there is no method matching the construct QuPropagator

Benchmarking quexpmv ...
ERROR: `QuPropagator{QPM<:QuPropagatorMethod,QVM<:Union(AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,2},AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,1}),QE<:QuEquation}` has no method matching QuPropagator{QPM<:QuPropagatorMethod,QVM<:Union(AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,2},AbstractQuArray{B<:AbstractBasis{S<:AbstractStructure},T,1}),QE<:QuEquation}(::QuArray{FiniteBasis{Orthonormal},Float64,2,Array{Float64,2}}, ::QuArray{FiniteBasis{Orthonormal},Complex{Float64},1,Array{Complex{Float64},1}}, ::FloatRange{Float64}, ::QuExpmV)

This comment has been minimized.

@acroy

acroy Jul 25, 2015

Contributor

Mhm, after using QuDynamics you shouldn't need to do type QuExpmV end. This would redefine QuExpmV and you should get a warning. Otherwise it should work as you suggest. You use the method types defined in QuDynamics directly for Alg ...

@acroy

acroy Jul 25, 2015

Contributor

Mhm, after using QuDynamics you shouldn't need to do type QuExpmV end. This would redefine QuExpmV and you should get a warning. Otherwise it should work as you suggest. You use the method types defined in QuDynamics directly for Alg ...

@acroy

This comment has been minimized.

Show comment
Hide comment
@acroy

acroy Jul 25, 2015

Contributor

I guess you meant perf/ instead of pref/? Please rename qho.jl to something more explicit and add (lots of) comments to explain what the code does.

Contributor

acroy commented Jul 25, 2015

I guess you meant perf/ instead of pref/? Please rename qho.jl to something more explicit and add (lots of) comments to explain what the code does.

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 25, 2015

Member

@acroy I hope this is ready. A review would be helpful

Member

amitjamadagni commented Jul 25, 2015

@acroy I hope this is ready. A review would be helpful

@acroy

This comment has been minimized.

Show comment
Hide comment
@acroy

acroy Jul 25, 2015

Contributor

Looks good. Did it work with using the types from QuDynamics for the Alg type parameter?

Contributor

acroy commented Jul 25, 2015

Looks good. Did it work with using the types from QuDynamics for the Alg type parameter?

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 25, 2015

Member

Yeah ! I will shortly link this to the notebooks so we have the results. So I will squash and merge this.

Member

amitjamadagni commented Jul 25, 2015

Yeah ! I will shortly link this to the notebooks so we have the results. So I will squash and merge this.

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 25, 2015

Member

@acroy Here is the notebook having the results. If this good we could merge this.

Member

amitjamadagni commented Jul 25, 2015

@acroy Here is the notebook having the results. If this good we could merge this.

@acroy

This comment has been minimized.

Show comment
Hide comment
@acroy

acroy Jul 25, 2015

Contributor

I think this looks good. Go ahead and merge.

Contributor

acroy commented Jul 25, 2015

I think this looks good. Go ahead and merge.

amitjamadagni added a commit that referenced this pull request Jul 26, 2015

Merge pull request #20 from amitjamadagni/pref
Benchmarks added. 
Jaynes-Cummings and Quantum Harmonic Oscillator.

@amitjamadagni amitjamadagni merged commit 8cb1c0a into JuliaQuantum:master Jul 26, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@amitjamadagni amitjamadagni deleted the amitjamadagni:pref branch Jul 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment