Skip to content

Commit

Permalink
squeezingop multiple dispatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
amitjamadagni committed Apr 18, 2015
1 parent c26e0b4 commit de8d52b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/arrays/ladderops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ function momentumop(n::Int)
end

squeeze_construct(a::AbstractQuMatrix,b::AbstractQuMatrix, z::Number) = scale!(0.5,(scale!(z',a*b)-scale!(z,a'*b')))
squeezing(a::AbstractQuMatrix, b::AbstractQuMatrix, z::Number) = expm(squeeze_construct(a,b,z))
squeeze(n::Int,z::Number) = squeezing(lowerop(n),lowerop(n),z)
squeezingop(a::AbstractQuMatrix, b::AbstractQuMatrix, z::Number) = expm(squeeze_construct(a,b,z))
squeezingop(n::Int,z::Number) = squeezingop(lowerop(n),lowerop(n),z)

displaceop(n::Int,alpha::Number) = expm(scale!(alpha,lowerop(n)')-scale!(alpha',lowerop(n)))

export raiseop,
lowerop,
positionop,
momentumop,
squeezing,
squeeze,
squeezingop,
displaceop
4 changes: 2 additions & 2 deletions test/operatortest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ m = momentumop(2)
# Squeeze, Squeezing Operators Test #
#####################################

@assert squeeze(2,1.0)== QuArray(eye(2))
@assert squeezing(lowerop(2), lowerop(2), 1.0) == squeeze(2,1)
@assert squeezingop(2,1.0)== QuArray(eye(2))
@assert squeezingop(lowerop(2), lowerop(2), 1.0) == squeezingop(2,1)

0 comments on commit de8d52b

Please sign in to comment.