Skip to content

Commit

Permalink
Changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
amitjamadagni committed Apr 10, 2015
1 parent 76c357a commit f409ff7
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions src/arrays/ladderops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,45 +37,7 @@ function momentumop(n::Int)
return scale(im/sqrt(2.), cop-cop')
end

function spin_h1(j::Float64)
if (isinteger(2*j) && j>0)
m = reverse([-j:j-1])
N = length(m)+1
m_coeffs = [sqrt(j*(j+1.0) - (x+1.0)*x) for x in m]
return spdiagm(m_coeffs,1,N,N)
else
return error("j must be non-negative integer or half integer")
end
end

function spin_h2(j::Float64)
if (isinteger(2*j) && j>0)
m = reverse([-j:j])
N = length(m)
return spdiagm(m,0,N,N)
else
return error("j must be non-negative integer or half integer")
end
end

spin_jx(j::Float64) = QuArray(0.5*(spin_h1(j)+spin_h1(j)'))
spin_jy(j::Float64) = QuArray(-0.5*im*(spin_h1(j)-spin_h1(j)'))
spin_jz(j::Float64) = QuArray(spin_h2(j))
spin_jp(j::Float64) = QuArray(spin_h1(j))
spin_jm(j::Float64) = QuArray(spin_h1(j)')
sigmax = 2.0 * spin_jx(0.5)
sigmay = 2.0 * spin_jy(0.5)
sigmaz = 2.0 * spin_jz(0.5)

export raiseop,
lowerop,
positionop,
momentumop,
spin_jx,
spin_jy,
spin_jz,
spin_jp,
spin_jm,
sigmax,
sigmay,
sigmaz
momentumop

0 comments on commit f409ff7

Please sign in to comment.