Skip to content
This repository was archived by the owner on Aug 21, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ julia 0.3
Compat
Docile
ODE 0.2.1
FastAnonymous
1 change: 1 addition & 0 deletions src/QuDynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module QuDynamics
using ODE
using Expokit
using ExpmV
using FastAnonymous
VERSION < v"0.4-" && using Docile
include("quequations.jl")
include("propmachinery.jl")
Expand Down
3 changes: 2 additions & 1 deletion src/propodesolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ for (qu_ode_type,ode_solver) in type_to_method_ode
dims = size(current_qustate)
# Convert the current_qustate to complex as it might result in a Inexact Error. After complex is in QuBase.jl (PR #38)
# we could just do a complex(vec(current_qustate)) avoiding the coeffs(coeffs(vec(current_qustate))).
next_state = $ode_solver((t,y)-> -im*coeffs(op)*y, complex(coeffs(vec(current_qustate))), [current_t, t], points=:specified,
f = @anon (t,y)-> -im*coeffs(op)*y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try to do scale!(coeffs(op)*y, -im), which should save one copy and some multiplications.

next_state = $ode_solver(f, complex(coeffs(vec(current_qustate))), [current_t, t], points=:specified,
reltol = get(prob.options, :reltol, 1.0e-5), abstol = get(prob.options, :abstol, 1.0e-8))[2][end]
CQST = QuBase.similar_type(current_qustate)
return CQST(reshape(next_state, dims), bases(current_qustate))
Expand Down