Skip to content

Commit

Permalink
Update src/Array.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Sánchez Ramírez <15837247+mofeing@users.noreply.github.com>
  • Loading branch information
jofrevalles and mofeing committed Apr 24, 2024
1 parent 5dbaf50 commit e5c5dc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Array{T}(op::Op) where {T,Op<:Control} = Array{T,2 * length(Op)}(op)
Array{T,N}(op::Control) where {T,N} = Array{T,N}(reshape(Matrix{T}(op), fill(2, N)...))

Array{T}(op::SU{N}) where {T,N} = Array{T,2N}(reshape(Matrix{T}(op), fill(2, 2N)...))
Array{T,M}(op::SU{N}) where {T,N,M} = (M == 2*N) ? Array{T,2N}(reshape(Matrix{T}(op), fill(2, 2N)...)) : throw(ArgumentError("Invalid dimensions"))
Array{T,M}(op::SU{N}) where {T,N,M} = (M == 2*N) ? Array{T,2N}(reshape(Matrix{T}(op), fill(2, 2N)...)) : throw(DimensionMismatch("Array representation of SU{$N} has $(2N) dimensions, but $M was solicited"))

# diagonal matrices
# NOTE efficient multiplication due to no memory swap needed: plain element-wise multiplication
Expand Down

0 comments on commit e5c5dc3

Please sign in to comment.