From c2ad518ca688d7d2cbe9f3d317da626619ea8aaa Mon Sep 17 00:00:00 2001 From: david-pl Date: Tue, 14 Aug 2018 10:51:31 +0200 Subject: [PATCH] v0.7 compatibility --- REQUIRE | 4 ++-- src/QuantumOptics.jl | 2 -- test/test_embed.jl | 2 +- test/test_fock.jl | 2 +- test/test_manybody.jl | 2 +- test/test_operators.jl | 2 +- test/test_operators_dense.jl | 2 +- test/test_operators_lazyproduct.jl | 2 +- test/test_operators_lazysum.jl | 2 +- test/test_operators_lazytensor.jl | 2 +- test/test_operators_sparse.jl | 2 +- test/test_particle.jl | 2 +- test/test_phasespace.jl | 2 +- test/test_spectralanalysis.jl | 2 +- test/test_state_definitions.jl | 8 ++++---- test/test_states.jl | 2 +- test/test_transformations.jl | 2 +- 17 files changed, 20 insertions(+), 22 deletions(-) diff --git a/REQUIRE b/REQUIRE index 4844f5f5..ef90d7fb 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,5 +1,5 @@ -julia 0.7-beta2 -OrdinaryDiffEq 4.7.1 +julia 0.7 +OrdinaryDiffEq 4.8.0 DiffEqCallbacks 2.1 StochasticDiffEq 5.6.0 RecursiveArrayTools 0.17.2 diff --git a/src/QuantumOptics.jl b/src/QuantumOptics.jl index 105067a2..2b399875 100644 --- a/src/QuantumOptics.jl +++ b/src/QuantumOptics.jl @@ -1,5 +1,3 @@ -__precompile__() - module QuantumOptics using SparseArrays, LinearAlgebra diff --git a/test/test_embed.jl b/test/test_embed.jl index 0078b879..d38b7ae8 100644 --- a/test/test_embed.jl +++ b/test/test_embed.jl @@ -4,7 +4,7 @@ using Random, SparseArrays, LinearAlgebra @testset "embed" begin -srand(0) +Random.seed!(0) # Set up operators spinbasis = SpinBasis(1//2) diff --git a/test/test_fock.jl b/test/test_fock.jl index 0e6c5d92..af3c0311 100644 --- a/test/test_fock.jl +++ b/test/test_fock.jl @@ -4,7 +4,7 @@ using Random, SparseArrays, LinearAlgebra @testset "fock" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) randstate(b) = normalize(Ket(b, rand(ComplexF64, length(b)))) diff --git a/test/test_manybody.jl b/test/test_manybody.jl index 170e6679..7791adc2 100644 --- a/test/test_manybody.jl +++ b/test/test_manybody.jl @@ -4,7 +4,7 @@ using Random, SparseArrays, LinearAlgebra @testset "manybody" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) D(x1::StateVector, x2::StateVector) = norm(x2-x1) diff --git a/test/test_operators.jl b/test/test_operators.jl index 6d792513..6cfe14c7 100644 --- a/test/test_operators.jl +++ b/test/test_operators.jl @@ -11,7 +11,7 @@ end @testset "operators" begin -srand(0) +Random.seed!(0) b1 = GenericBasis(5) b2 = GenericBasis(3) diff --git a/test/test_operators_dense.jl b/test/test_operators_dense.jl index 64573334..2cda56fa 100644 --- a/test/test_operators_dense.jl +++ b/test/test_operators_dense.jl @@ -4,7 +4,7 @@ using Random, SparseArrays, LinearAlgebra @testset "operators-dense" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) D(x1::StateVector, x2::StateVector) = norm(x2-x1) diff --git a/test/test_operators_lazyproduct.jl b/test/test_operators_lazyproduct.jl index 918358cb..4d43a94e 100644 --- a/test/test_operators_lazyproduct.jl +++ b/test/test_operators_lazyproduct.jl @@ -5,7 +5,7 @@ using LinearAlgebra, Random @testset "operators-lazyproduct" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) D(x1::StateVector, x2::StateVector) = norm(x2-x1) diff --git a/test/test_operators_lazysum.jl b/test/test_operators_lazysum.jl index c8a928ff..10a270b8 100644 --- a/test/test_operators_lazysum.jl +++ b/test/test_operators_lazysum.jl @@ -5,7 +5,7 @@ using LinearAlgebra, Random @testset "operators-lazysum" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) D(x1::StateVector, x2::StateVector) = norm(x2-x1) diff --git a/test/test_operators_lazytensor.jl b/test/test_operators_lazytensor.jl index a1106395..1d36abc3 100644 --- a/test/test_operators_lazytensor.jl +++ b/test/test_operators_lazytensor.jl @@ -11,7 +11,7 @@ end @testset "operators-lazytensor" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) D(x1::StateVector, x2::StateVector) = norm(x2-x1) diff --git a/test/test_operators_sparse.jl b/test/test_operators_sparse.jl index 32584b4b..a7beda85 100644 --- a/test/test_operators_sparse.jl +++ b/test/test_operators_sparse.jl @@ -9,7 +9,7 @@ mutable struct TestOperator <: Operator; end @testset "operators-sparse" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) D(x1::StateVector, x2::StateVector) = norm(x2-x1) diff --git a/test/test_particle.jl b/test/test_particle.jl index 61e9d6a1..1a464834 100644 --- a/test/test_particle.jl +++ b/test/test_particle.jl @@ -4,7 +4,7 @@ using FFTW, LinearAlgebra, Random @testset "particle" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) diff --git a/test/test_phasespace.jl b/test/test_phasespace.jl index 0fc61413..b2cf7e88 100644 --- a/test/test_phasespace.jl +++ b/test/test_phasespace.jl @@ -4,7 +4,7 @@ using Random, LinearAlgebra @testset "phasespace" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) diff --git a/test/test_spectralanalysis.jl b/test/test_spectralanalysis.jl index 14d4e895..e40b7dea 100644 --- a/test/test_spectralanalysis.jl +++ b/test/test_spectralanalysis.jl @@ -6,7 +6,7 @@ mutable struct SpectralanalysisTestOperator <: Operator end @testset "spectralanalysis" begin -srand(0) +Random.seed!(0) sprandop(b) = sparse(DenseOperator(b, rand(ComplexF64, length(b), length(b)))) diff --git a/test/test_state_definitions.jl b/test/test_state_definitions.jl index fde9987a..7c7c0ddb 100644 --- a/test/test_state_definitions.jl +++ b/test/test_state_definitions.jl @@ -4,7 +4,7 @@ using QuantumOptics @testset "state_definitions" begin n=30 -b=FockBasis(n) +b=FockBasis(n) omega=40.3 T=2.3756 r=thermalstate(omega*number(b),T) @@ -14,7 +14,7 @@ end S=entropy_vn(r) z=sum(exp.(-[0:n;]*omega)) s=expect(omega*number(b),r)/T+log(z) -isapprox(S,s) +isapprox(S,s) alpha=rand()+im*rand() r=coherentthermalstate(b,omega*number(b),T,alpha) @@ -23,7 +23,7 @@ r=coherentthermalstate(b,omega*number(b),T,alpha) @test isapprox(entropy_vn(r),S) rp=phase_average(r) -@test isapprox(expect(number(b),rp),abs(alpha)^2+1/(exp(omega/T)-1)) +@test isapprox(expect(number(b),rp),abs(alpha)^2+1/(exp(omega/T)-1), atol=1e-14) @test isapprox(expect(destroy(b),rp),0) for k=1:n @test isapprox(rp.data[k,k],r.data[k,k]) @@ -36,5 +36,5 @@ end @test isapprox(expect(number(b),rpas),1/(exp(omega/T)-1)) @test isapprox(expect(destroy(b),rpas),0) @test isapprox(entropy_vn(rpas),S) - + end # testset diff --git a/test/test_states.jl b/test/test_states.jl index c45e2351..31c00f2c 100644 --- a/test/test_states.jl +++ b/test/test_states.jl @@ -4,7 +4,7 @@ using LinearAlgebra, Random @testset "states" begin -srand(0) +Random.seed!(0) D(x1::Number, x2::Number) = abs(x2-x1) D(x1::StateVector, x2::StateVector) = norm(x2-x1) diff --git a/test/test_transformations.jl b/test/test_transformations.jl index 1cb92439..c79066ef 100644 --- a/test/test_transformations.jl +++ b/test/test_transformations.jl @@ -4,7 +4,7 @@ using Random, LinearAlgebra @testset "transformation" begin -srand(0) +Random.seed!(0) D(op1::Operator, op2::Operator) = abs(tracedistance_nh(dense(op1), dense(op2))) D(x::Ket, y::Ket) = norm(x-y)