Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ytdHuang committed Dec 26, 2024
1 parent 0999688 commit 53f71ac
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/qobj/eigsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function _eigsolve(
A,
b::AbstractVector{T},
type::ObjType,
dims::SVector,
dims::AbstractDimensions,
k::Int = 1,
m::Int = max(20, 2 * k + 1);
tol::Real = 1e-8,
Expand Down Expand Up @@ -296,7 +296,7 @@ function eigsolve(
A;
v0::Union{Nothing,AbstractVector} = nothing,
type::Union{Nothing,OperatorQuantumObject,SuperOperatorQuantumObject} = nothing,
dims = SVector{0,Int}(),
dims = Dimensions{0}(SVector{0,AbstractSpace}()),
sigma::Union{Nothing,Real} = nothing,
k::Int = 1,
krylovdim::Int = max(20, 2 * k + 1),
Expand All @@ -309,8 +309,6 @@ function eigsolve(
isH = ishermitian(A)
v0 === nothing && (v0 = normalize!(rand(T, size(A, 1))))

dims = SVector(dims)

if sigma === nothing
res = _eigsolve(A, v0, type, dims, k, krylovdim, tol = tol, maxiter = maxiter)
vals = res.values
Expand Down
2 changes: 1 addition & 1 deletion src/spin_lattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function MultiSiteOperator(dims::Union{AbstractVector,Tuple}, pairs::Pair{<:Inte

sites, ops = _get_unique_sites_ops(_sites, _ops)

collect(dims)[sites] == [op.dims[1] for op in ops] || throw(ArgumentError("The dimensions of the operators do not match the dimensions of the lattice."))
_dims[sites] == [op.to[1].size for op in ops] || throw(ArgumentError("The dimensions of the operators do not match the dimensions of the lattice."))

data = kron(I(prod(_dims[1:sites[1]-1])), ops[1].data)
for i in 2:length(sites)
Expand Down
4 changes: 2 additions & 2 deletions src/time_evolution/time_evolution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ A Julia constructor for handling the `ODEProblem` of the time evolution of quant
- `prob::AbstractSciMLProblem`: The `ODEProblem` of the time evolution.
- `times::Abstractvector`: The time list of the evolution.
- `dims::Abstractvector`: The dimensions of the Hilbert space.
- `dims::AbstractDimensions`: The dimensions of the Hilbert space.
- `kwargs::KWT`: Generic keyword arguments.
"""
struct TimeEvolutionProblem{PT<:AbstractSciMLProblem,TT<:AbstractVector,DT<:AbstractVector,KWT}
struct TimeEvolutionProblem{PT<:AbstractSciMLProblem,TT<:AbstractVector,DT<:AbstractDimensions,KWT}
prob::PT
times::TT
dims::DT
Expand Down
2 changes: 1 addition & 1 deletion test/core-test/low_rank_dynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
M = latt.N + 1 # Number of states in the LR basis

# Define initial state
ϕ = Vector{QuantumObject{Vector{ComplexF64},KetQuantumObject,M - 1}}(undef, M)
ϕ = Vector{QuantumObject{Vector{ComplexF64},KetQuantumObject,Dimensions{M - 1}}}(undef, M)
ϕ[1] = kron(fill(basis(2, 1), N_modes)...)

i = 1
Expand Down
10 changes: 5 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ core_tests = [
# "correlations_and_spectrum.jl",
# "dynamical_fock_dimension_mesolve.jl",
# "dynamical-shifted-fock.jl",
# "eigenvalues_and_operators.jl",
"eigenvalues_and_operators.jl",
"entanglement.jl",
# "generalized_master_equation.jl",
# "low_rank_dynamics.jl",
"low_rank_dynamics.jl",
"negativity_and_partial_transpose.jl",
"progress_bar.jl",
"quantum_objects.jl",
"quantum_objects_evo.jl",
"states_and_operators.jl",
# "steady_state.jl",
# "time_evolution.jl",
"time_evolution.jl",
"utilities.jl",
# "wigner.jl",
"wigner.jl",
]

if (GROUP == "All") || (GROUP == "Code-Quality")
using QuantumToolbox
using Aqua, JET

#include(joinpath(testdir, "core-test", "code_quality.jl"))
include(joinpath(testdir, "core-test", "code_quality.jl"))
end

if (GROUP == "All") || (GROUP == "Core")
Expand Down

0 comments on commit 53f71ac

Please sign in to comment.