Skip to content

Commit

Permalink
Sparse support for AbstractQuMatrix.
Browse files Browse the repository at this point in the history
  • Loading branch information
amitjamadagni committed Oct 2, 2015
1 parent c8fdb89 commit 9f77b9c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/arrays/arraymath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,23 @@ normalize(qarr::AbstractQuArray) = normalize!(copy(qarr))
# matrix operations returning an array
# sparse to dense
function Base.full(qarr::AbstractQuMatrix)
fc = full(rawcoeffs(qarr))
fc = full(coeffs(qarr))
QAT = similar_type(qarr)
return QAT(fc, bases(qarr))
end

# convert to a sparse matrix
function Base.sparse(qarr::AbstractQuMatrix)
sc = sparse(coeffs(qarr))
QAT = similar_type(qarr)
return QAT(sc, bases(qarr))
end

#Base.full(ct::CTranspose) = full(ct.qarr)'

# exponential of dense matrix
function Base.expm(qarr::AbstractQuMatrix)
fc = expm(full(rawcoeffs(qarr)))
fc = expm(full(coeffs(qarr)))
QAT = similar_type(qarr)
return QAT(fc, bases(qarr))
end
Expand Down

0 comments on commit 9f77b9c

Please sign in to comment.