Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:

include:
# for core tests (intermediate versions)
# - version: '1.x'
# node:
# os: 'ubuntu-latest'
# arch: 'x64'
# group: 'Core'
- version: '1.11'
node:
os: 'ubuntu-latest'
arch: 'x64'
group: 'Core'
Comment on lines +59 to +63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Julia 1.12.0 has become the new latest version. so we should at least run a core test for 1.11.


# for extension tests
- version: '1'
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://github.com/qutip/QuantumToolbox.jl/tree/main)

- Fix `cite()` bibtex output. ([#552])
- Add `qeye_like` and `qzero_like`, which are synonyms of `one` and `zero`. ([#555])

## [v0.36.0]
Release date: 2025-09-29
Expand Down Expand Up @@ -326,3 +327,4 @@ Release date: 2024-11-13
[#544]: https://github.com/qutip/QuantumToolbox.jl/issues/544
[#546]: https://github.com/qutip/QuantumToolbox.jl/issues/546
[#552]: https://github.com/qutip/QuantumToolbox.jl/issues/552
[#555]: https://github.com/qutip/QuantumToolbox.jl/issues/555
2 changes: 2 additions & 0 deletions docs/src/resources/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ logm
expm
sinm
cosm
qeye_like
qzero_like
```

## [Time evolution](@id doc-API:Time-evolution)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/users_guide/QuantumObject/QuantumObject_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Here is a table that summarizes all the supported linear algebra functions and a

| **Description** | **Function call** | **Synonyms** |
|:----------------|:------------------|:-------------|
| zero-like array | [`zero(Q)`](@ref zero) | - |
| identity-like matrix | [`one(Q)`](@ref one) | - |
| zero-like array | [`zero(Q)`](@ref zero) | [`qzero_like(Q)`](@ref qzero_like) |
| identity-like matrix | [`one(Q)`](@ref one) | [`qeye_like(Q)`](@ref qeye_like) |
| conjugate | [`conj(Q)`](@ref conj) | - |
| transpose | [`transpose(Q)`](@ref transpose) | [`trans(Q)`](@ref trans) |
| conjugate transposition | [`adjoint(Q)`](@ref adjoint) | [`Q'`](@ref adjoint), [`dag(Q)`](@ref dag) |
Expand Down
20 changes: 19 additions & 1 deletion src/qobj/synonyms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Synonyms of the functions for QuantumObject
export Qobj, QobjEvo, shape, isherm
export trans, dag, matrix_element, unit
export tensor, ⊗
export qeye
export qeye, qeye_like, qzero_like
export vector_to_operator, operator_to_vector
export sqrtm, logm, expm, sinm, cosm

Expand Down Expand Up @@ -104,3 +104,21 @@ Matrix cosine of [`QuantumObject`](@ref), defined as
Note that this function is same as `cos(A)` and only supports for [`Operator`](@ref) and [`SuperOperator`](@ref).
"""
cosm(A::QuantumObject{ObjType}) where {ObjType<:Union{Operator,SuperOperator}} = cos(A)

@doc raw"""
qeye_like(A::AbstractQuantumObject)

Return a similar [`AbstractQuantumObject`](@ref) with `dims` and `type` are same as `A`, but `data` is an identity matrix.

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)

@doc raw"""
qzero_like(A::AbstractQuantumObject)

Return a similar [`AbstractQuantumObject`](@ref) with `dims` and `type` are same as `A`, but `data` is a zero-array.

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)
4 changes: 2 additions & 2 deletions test/core-test/quantum_objects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@
@test (a2 + 2).data == a2.data + 2 * I
@test a2 * 2 == 2 * a2

zero_like = zero(a2)
iden_like = one(a3)
zero_like = qzero_like(a2)
iden_like = qeye_like(a3)
zero_array = spzeros(ComplexF64, 100, 100)
iden_array = sparse(1:100, 1:100, ones(ComplexF64, 100))
@test zero_like == Qobj(zero_array, type = a2.type, dims = a2.dims)
Expand Down
4 changes: 2 additions & 2 deletions test/core-test/quantum_objects_evo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
@test (a2 + 2).data == a2.data + 2 * I
@test a2 * 2 == 2 * a2

zero_like = zero(a2)
iden_like = one(a3)
zero_like = qzero_like(a2)
iden_like = qeye_like(a3)
zero_array = NullOperator(100)
iden_array = IdentityOperator(100)
@test zero_like == QobjEvo(zero_array, type = a2.type, dims = a2.dims)
Expand Down
Loading