Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/qobj/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# Because inv(Λ) ⋅ R has real and strictly positive elements, Q · Λ is therefore Haar distributed.
Λ = diag(R) # take the diagonal elements of R
Λ ./= abs.(Λ) # rescaling the elements
return QuantumObject(dense_to_sparse(Q * Diagonal(Λ)); type = Operator, dims = dimensions)
return QuantumObject(sparse_to_dense(Q * Diagonal(Λ)); type = Operator, dims = dimensions)

Check warning on line 51 in src/qobj/operators.jl

View check run for this annotation

Codecov / codecov/patch

src/qobj/operators.jl#L51

Added line #L51 was not covered by tests
end
function rand_unitary(dimensions::Union{AbstractVector{Int},Tuple}, ::Val{:exp})
N = prod(dimensions)
Expand All @@ -59,7 +59,7 @@
# generate Hermitian matrix
H = QuantumObject((Z + Z') / 2; type = Operator, dims = dimensions)

return exp(-1.0im * H)
return sparse_to_dense(exp(-1.0im * H))

Check warning on line 62 in src/qobj/operators.jl

View check run for this annotation

Codecov / codecov/patch

src/qobj/operators.jl#L62

Added line #L62 was not covered by tests
end
rand_unitary(dimensions::Union{AbstractVector{Int},Tuple}, ::Val{T}) where {T} =
throw(ArgumentError("Invalid distribution: $(T)"))
Expand Down