Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optimize `liouvillian_dressed_nonsecular`: avoid O(N⁴) dense filter matrices. ([#627])
- Restrict `CUDA.jl` version compatibility to < 5.9.6 due to breaking changes in that release. ([#630])
- Move from `JuliaFormatter.jl` to `Runic.jl` for code formatting. ([#633])
- Updated `qeye_like` to properly handle `QobjEvo` types.

## [v0.40.0]
Release date: 2025-12-21
Expand Down
9 changes: 9 additions & 0 deletions src/qobj/arithmetic_and_attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -751,3 +751,12 @@ _dims_and_perm(::Operator, dims::SVector{2, SVector{N, Int}}, order::AbstractVec
_order_dimensions(dimensions::Dimensions, order::AbstractVector{Int}) = Dimensions(dimensions.to[order])
_order_dimensions(dimensions::GeneralDimensions, order::AbstractVector{Int}) =
GeneralDimensions(dimensions.to[order], dimensions.from[order])


_find_matrix(A::AbstractArray) = A
_find_matrix(A::MatrixOperator) = A.A
_find_matrix(A::ScaledOperator) = _find_matrix(A.L)
function _find_matrix(A::Union{AddedOperator, ComposedOperator})
idx = findfirst(x -> _find_matrix(x) isa AbstractMatrix, A.ops)
return _find_matrix(A.ops[idx])
end
4 changes: 2 additions & 2 deletions src/qobj/synonyms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Return a similar [`AbstractQuantumObject`](@ref) with `dims` and `type` are same

Note that this function is same as `one(A)` and only supports for [`Operator`](@ref) and [`SuperOperator`](@ref).
"""
qeye_like(A::AbstractQuantumObject{OpType}) where {OpType <: Union{Operator, SuperOperator}} = one(A)
qeye_like(A::AbstractQuantumObject{OpType}) where {OpType <: Union{Operator, SuperOperator}} = QuantumObject(one(_find_matrix(A.data)), A.type, A.dimensions)

@doc raw"""
qzero_like(A::AbstractQuantumObject)
Expand All @@ -124,4 +124,4 @@ Return a similar [`AbstractQuantumObject`](@ref) with `dims` and `type` are same

Note that this function is same as `zero(A)` and only supports for [`Operator`](@ref) and [`SuperOperator`](@ref).
"""
qzero_like(A::AbstractQuantumObject{OpType}) where {OpType <: Union{Operator, SuperOperator}} = zero(A)
qzero_like(A::AbstractQuantumObject{OpType}) where {OpType <: Union{Operator, SuperOperator}} = QuantumObject(zero(_find_matrix(A.data)), A.type, A.dimensions)