This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
immutable TimeStepState | |
tlist::Array | |
t_index::Int | |
end | |
Base.start(state::TimeStepState) = state.tlist[1] | |
Base.next(state::TimeStepState) = state.tlist[state.t_index+1], state.tlist[state.t_index] | |
Base.done(state::TimeStepState) = state.tlist[state.t_index] == state.tlist[end] ? true : false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using QuBase | |
function krylov_prop(hamiltonian::QuMatrix, init_state::QuVector, tlist::Array) | |
v = Array(typeof(init_state),0) | |
push!(v,zeros(init_state)) | |
push!(v,init_state) | |
w = Array(typeof(init_state),0) | |
alpha = Array(Complex{Float64},0) | |
beta = Array(Complex{Float64},0) | |
push!(beta,0.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("/home/esornep/Downloads/SemVII/QuBase.jl/src/QuBase.jl") | |
using QuBase | |
abstract QuantumPropagator{B<:AbstractBasis,T,A} | |
immutable QuEuler{B<:AbstractBasis,T,A} <: QuantumPropagator{B,T,A} | |
hamiltonian::QuMatrix{B,T,A} | |
init_state::QuVector | |
tlist::Array | |
QuEuler(hamiltonian, init_state, tlist) = new(hamiltonian, init_state, tlist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using QuBase | |
abstract QuantumPropagator | |
type Euler <: QuantumPropagator | |
hamiltonian::QuMatrix | |
init_state::QuVector | |
tlist::Array | |
Euler(hamiltonian, init_state, tlist) = new(hamiltonian, init_state, tlist) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using QuBase | |
abstract QuantumPropagator | |
type Euler <: QuantumPropagator | |
hamiltonian::QuMatrix | |
init_state::QuVector | |
tlist::Array | |
options | |
Euler(hamiltonian, init_state, tlist) = new(hamiltonian, init_state, tlist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using QuBase | |
using Base.Test | |
function initialize(hamiltonian::QuMatrix, init_state::QuVector, tlist::Array) | |
final_state = Array(typeof(init_state),0) | |
sizehint(final_state, length(tlist)) | |
push!(final_state, init_state) | |
return final_state | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using QuBase | |
using Base.Test | |
function initialize(hamiltonian::QuMatrix, init_state::QuVector, tlist::Array) | |
final_state = Array(typeof(init_state),0) | |
sizehint(final_state, length(tlist)) | |
push!(final_state, init_state) | |
return final_state | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initialize(hamiltonian::QuMatrix, init_state::QuVector, tlist::Array) | |
final_state = Array(typeof(init_state),0) | |
sizehint(final_state, length(tlist)) | |
push!(final_state, init_state) | |
return final_state | |
end | |
function solver_euler(hamiltonian::QuMatrix, init_state::QuVector, tlist::Array) | |
final_state = initialize(hamiltonian, init_state, tlist) | |
for i=2:length(tlist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using QuBase | |
using Base.Test | |
function solver_euler(hamiltonian::QuMatrix, init_state::QuVector, tlist::Array) | |
final_state = QuArray[] | |
push!(final_state, init_state) | |
uni = QuArray(eye(size(hamiltonian,1)))-im*hamiltonian*(tlist[2]-tlist[1]) | |
for i=2:length(tlist) | |
push!(final_state, uni*final_state[i-1]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: http://docs.julialang.org | |
_ _ _| |_ __ _ | Type "help()" for help. | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.4.0-dev+2757 (2015-01-28 19:10 UTC) | |
_/ |\__'_|_|_|\__'_| | rorl/aea475d* (fork: 1 commits, 70 days) | |
|__/ | x86_64-linux-gnu | |
julia> using QuBase | |
Warning: New definition |