Skip to content

Commit 3511c0a

Browse files
authored
Merge branch 'qutip:main' into fa/resolve
2 parents 545c9b9 + a965621 commit 3511c0a

28 files changed

+99
-87
lines changed

Project.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,4 @@ SparseArrays = "1"
6464
SpecialFunctions = "2"
6565
StaticArraysCore = "1"
6666
StochasticDiffEq = "6"
67-
Test = "1"
6867
julia = "1.10"
69-
70-
[extras]
71-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
72-
73-
[targets]
74-
test = ["Test"]

docs/src/resources/contributing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ The tests are divided into several test groups, where the group names are define
3838
make GROUP=Core test
3939
```
4040

41+
### [Test Item Framework for Core tests](@id doc-Contribute:Test-Item-Framework-for-Core-tests)
42+
43+
The tests in `GROUP=Core` are provided using the [Test Item Framework](https://www.julia-vscode.org/docs/stable/userguide/testitems/), which structures the test codes into `@testitems` and makes it easier to run individually.
44+
45+
The [VS Code](https://code.visualstudio.com/) and its [Julia extension](https://www.julia-vscode.org/) provides us with options to run individual `@testitems`. It is much easier to find the specific core test that failed since the [Julia extension](https://www.julia-vscode.org/) in [VS Code](https://code.visualstudio.com/) will collect all core test failures and then display them in a structured way, directly at the place in the code where a specific core test failed. See [here](https://www.julia-vscode.org/docs/stable/userguide/testitems/) for more details.
46+
4147
## [Julia Code Format](@id doc-Contribute:Julia-Code-Format)
4248

4349
We use [`JuliaFormatter.jl`](https://github.com/domluna/JuliaFormatter.jl) to format all the source codes. The code style and extra formatting options is defined in the file `.JuliaFormatter.toml` in the repository.

src/qobj/quantum_object_base.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,41 +30,53 @@ Constructor representing a bra state ``\langle\psi|``.
3030
"""
3131
struct Bra <: QuantumObjectType end
3232

33+
Base.show(io::IO, ::Bra) = print(io, "Bra()")
34+
3335
@doc raw"""
3436
Ket <: QuantumObjectType
3537
3638
Constructor representing a ket state ``|\psi\rangle``.
3739
"""
3840
struct Ket <: QuantumObjectType end
3941

42+
Base.show(io::IO, ::Ket) = print(io, "Ket()")
43+
4044
@doc raw"""
4145
Operator <: QuantumObjectType
4246
4347
Constructor representing an operator ``\hat{O}``.
4448
"""
4549
struct Operator <: QuantumObjectType end
4650

51+
Base.show(io::IO, ::Operator) = print(io, "Operator()")
52+
4753
@doc raw"""
4854
SuperOperator <: SuperOperatorType
4955
5056
Constructor representing a super-operator ``\hat{\mathcal{O}}`` acting on vectorized density operator matrices.
5157
"""
5258
struct SuperOperator <: SuperOperatorType end
5359

60+
Base.show(io::IO, ::SuperOperator) = print(io, "SuperOperator()")
61+
5462
@doc raw"""
5563
OperatorBra <: QuantumObjectType
5664
5765
Constructor representing a bra state in the [`SuperOperator`](@ref) formalism ``\langle\langle\rho|``.
5866
"""
5967
struct OperatorBra <: QuantumObjectType end
6068

69+
Base.show(io::IO, ::OperatorBra) = print(io, "OperatorBra()")
70+
6171
@doc raw"""
6272
OperatorKet <: QuantumObjectType
6373
6474
Constructor representing a ket state in the [`SuperOperator`](@ref) formalism ``|\rho\rangle\rangle``.
6575
"""
6676
struct OperatorKet <: QuantumObjectType end
6777

78+
Base.show(io::IO, ::OperatorKet) = print(io, "OperatorKet()")
79+
6880
@doc raw"""
6981
size(A::AbstractQuantumObject)
7082
size(A::AbstractQuantumObject, idx::Int)

src/qobj/quantum_object_evo.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,17 +440,8 @@ end
440440

441441
_promote_to_scimloperator(data::AbstractMatrix) = MatrixOperator(data)
442442
_promote_to_scimloperator(data::AbstractSciMLOperator) = data
443-
# TODO: The following special cases can be simplified after
444-
# https://github.com/SciML/SciMLOperators.jl/pull/264 is merged
445443
_promote_to_scimloperator::Number, data::AbstractMatrix) = MatrixOperator* data)
446-
function _promote_to_scimloperator::Number, data::MatrixOperator)
447-
isconstant(data) && return MatrixOperator* data.A)
448-
return ScaledOperator(α, data) # Going back to the generic case
449-
end
450-
function _promote_to_scimloperator::Number, data::ScaledOperator)
451-
isconstant(data.λ) && return ScaledOperator* data.λ, data.L)
452-
return ScaledOperator(data.λ, _promote_to_scimloperator(α, data.L)) # Try to propagate the rule
453-
end
444+
# We still have to define this for AddedOperator, as it is not present in SciMLOperators.jl
454445
function _promote_to_scimloperator::Number, data::AddedOperator)
455446
return AddedOperator(_promote_to_scimloperator.(α, data.ops)) # Try to propagate the rule
456447
end

src/time_evolution/mesolve.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,7 @@ function mesolveProblem(
9797

9898
tspan = (tlist[1], tlist[end])
9999

100-
# TODO: Remove this when https://github.com/SciML/SciMLSensitivity.jl/issues/1181 is fixed
101-
if haskey(kwargs3, :sensealg)
102-
prob = ODEProblem{getVal(inplace)}(L, ρ0, tspan, params; kwargs3...)
103-
else
104-
prob = ODEProblem{getVal(inplace),FullSpecialize}(L, ρ0, tspan, params; kwargs3...)
105-
end
100+
prob = ODEProblem{getVal(inplace),FullSpecialize}(L, ρ0, tspan, params; kwargs3...)
106101

107102
return TimeEvolutionProblem(prob, tlist, L_evo.dimensions, (isoperket = Val(isoperket(ψ0)),))
108103
end

src/time_evolution/sesolve.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@ function sesolveProblem(
7676

7777
tspan = (tlist[1], tlist[end])
7878

79-
# TODO: Remove this when https://github.com/SciML/SciMLSensitivity.jl/issues/1181 is fixed
80-
if haskey(kwargs3, :sensealg)
81-
prob = ODEProblem{getVal(inplace)}(U, ψ0, tspan, params; kwargs3...)
82-
else
83-
prob = ODEProblem{getVal(inplace),FullSpecialize}(U, ψ0, tspan, params; kwargs3...)
84-
end
79+
prob = ODEProblem{getVal(inplace),FullSpecialize}(U, ψ0, tspan, params; kwargs3...)
8580

8681
return TimeEvolutionProblem(prob, tlist, H_evo.dimensions)
8782
end

test/Project.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[deps]
2+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
4+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
5+
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
6+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
7+
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
8+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
9+
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
10+
11+
[compat]
12+
Pkg = "1"
13+
Test = "1"
14+
TestItemRunner = "1"

test/core-test/block_diagonal_form.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testset "Block Diagonal Form" begin
1+
@testitem "Block Diagonal Form" begin
22
# Block Diagonal Form
33
N = 20
44
Δ = 0

test/core-test/code-quality/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
33
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
44
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
5+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
56

67
[compat]
78
Aqua = "0.8"

test/core-test/correlations_and_spectrum.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testset "Correlations and Spectrum" begin
1+
@testitem "Correlations and Spectrum" begin
22
N = 10
33
Id = qeye(N)
44
a = destroy(N)

0 commit comments

Comments
 (0)