Skip to content

Commit

Permalink
Fix indexing test
Browse files Browse the repository at this point in the history
  • Loading branch information
david-pl committed Feb 27, 2024
1 parent 897cdaf commit 3772f37
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/test_index_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,14 @@ j1 = Index(h_,:j1,N_f,hfock)
ai(i) = IndexedOperator(Destroy(h_,:a),i)
σi(i,j,k) = IndexedOperator(Transition(h_,,i,j),k)

@test to_numeric(ai(1),b_;ranges=ranges) isa Operator
@test to_numeric(ai(1),b_;ranges=ranges) == QuantumOpticsBase.embed(b_,5,destroy(bfock))
@test to_numeric(ai(2),b_;ranges=ranges) == QuantumOpticsBase.embed(b_,6,destroy(bfock))
@test to_numeric(σi(1,2,4),b_;ranges=ranges) isa Operator
@test to_numeric(σi(1,2,4),b_;ranges=ranges) == QuantumOpticsBase.embed(b_,4,transition(bnlevel,1,2))
@test to_numeric(ai(1),b_;ranges=ranges) == LazyTensor(b_, [5], (destroy(bfock),))
@test to_numeric(ai(2),b_;ranges=ranges) == LazyTensor(b_, [6], (destroy(bfock),))
@test to_numeric(σi(1,2,4),b_;ranges=ranges) == LazyTensor(b_, [4], (transition(bnlevel,1,2),))
@test_throws MethodError to_numeric(σi(1,2,5),b_;ranges=ranges)

ai2(i) = IndexedOperator(Destroy(hfock,:a),i)
@test to_numeric(ai2(1),b_2;ranges=[2]) isa Operator
@test to_numeric(ai2(2),b_2;ranges=[2]) isa Operator
@test to_numeric(ai2(1),b_2;ranges=[2]) isa LazyTensor
@test to_numeric(ai2(2),b_2;ranges=[2]) isa LazyTensor
@test_throws BoundsError to_numeric(ai2(3),b_2;ranges=[2])

# Indices and only one HilbertSpace
Expand Down

0 comments on commit 3772f37

Please sign in to comment.