qojulia / QuantumOptics.jl

Library for the numerical simulation of closed as well as open quantum systems.
http://qojulia.org
Other
518 stars 101 forks source link

added method for recast! #340

Closed AmitRotem closed 1 year ago

AmitRotem commented 1 year ago

dynamics of Operator with different left and right basis would fail. for example;

b1 = FockBasis(4)
b2 = NLevelBasis(2)
H(t,u) = number(b1) + destroy(b1) + create(b1)
ψ0 = projector(b1, SubspaceBasis(b1,[basisstate.([b1],1:2)...]))
ψ1 = Operator(ψ0.basis_l, FockBasis(1), ψ0.data)
timeevolution.schroedinger_dynamic(range(0,1,10), ψ1, H); # ok
timeevolution.schroedinger_dynamic(range(0,1,10), ψ0, H); # fail

recast! of an Operator type with different left and right basis fixes this. This is useful for propagating a subset of states.

amilsted commented 1 year ago

Ah, I think I've seen this before. Thanks Amit!

amilsted commented 1 year ago

We should add a simple test of this case.

AmitRotem commented 1 year ago

I've added a test

codecov[bot] commented 1 year ago

Codecov Report

Merging #340 (40eddb9) into master (db7242f) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #340   +/-   ##
=======================================
  Coverage   98.02%   98.02%           
=======================================
  Files          16       16           
  Lines        1415     1418    +3     
=======================================
+ Hits         1387     1390    +3     
  Misses         28       28           
Impacted Files Coverage Δ
src/schroedinger.jl 90.62% <100.00%> (+0.96%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

amilsted commented 1 year ago

LGTM