Skip to content

Commit

Permalink
Added float, int. Fixed \ warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
amitjamadagni committed Sep 22, 2015
1 parent f555684 commit 5c72208
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/arrays/arraymath.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Base: *, +, -, /
import Base: *, +, -, /,\

##################
# Multiplication #
Expand Down Expand Up @@ -123,6 +123,8 @@ end

# convert coeffs to complex
Base.complex{B<:OrthonormalBasis}(qarr::AbstractQuArray{B}) = similar_type(qarr)(complex(coeffs(qarr)), bases(qarr))
Base.float{B<:OrthonormalBasis}(qarr::AbstractQuArray{B}) = similar_type(qarr)(float(coeffs(qarr)), bases(qarr))
Base.int{B<:OrthonormalBasis}(qarr::AbstractQuArray{B}) = similar_type(qarr)(int(coeffs(qarr)), bases(qarr))

# Vectorize QuArray
Base.vec{B<:OrthonormalBasis}(vec1::AbstractQuArray{B}) = QuArray(vec(coeffs(vec1)))
Expand Down
2 changes: 2 additions & 0 deletions test/multest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ qv1 = normalize!(QuArray(v1))

# Complex coeffs
@assert complex(statevec(1, FiniteBasis(2))) == QuArray([1.+0.*im, 0.+0.*im])
@assert float(statevec(1, FiniteBasis(2))) == QuArray([1., 0.])
@assert int(statevec(1, FiniteBasis(2))) == QuArray([1, 0])

0 comments on commit 5c72208

Please sign in to comment.