Skip to content

Commit 6ab7a09

Browse files
committed
format files
1 parent ecec278 commit 6ab7a09

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

benchmarks/correlations_and_spectrum.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ function benchmark_correlations_and_spectrum!(SUITE)
1414
function _calculate_fft_spectrum(H, tlist, c_ops, A, B)
1515
corr = correlation_2op_1t(H, nothing, tlist, c_ops, A, B; progress_bar = Val(false))
1616
ωlist, spec = spectrum_correlation_fft(tlist, corr)
17-
nothing
17+
return nothing
1818
end
1919

2020
SUITE["Correlations and Spectrum"]["FFT Correlation"] =
2121
@benchmarkable _calculate_fft_spectrum($H, $t_l, $c_ops, $(a'), $a)
2222

23-
SUITE["Correlations and Spectrum"]["Spectrum"]["Exponential Series"] = @benchmarkable spectrum($H, $ω_l, $c_ops, $(a'), $a)
23+
SUITE["Correlations and Spectrum"]["Spectrum"]["Exponential Series"] =
24+
@benchmarkable spectrum($H, $ω_l, $c_ops, $(a'), $a)
2425

2526
return nothing
2627
end

src/correlations.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function correlation_3op_2t(
3939
ψ0 = steadystate(L)
4040
end
4141

42-
allequal((L.dims, ψ0.dims, A.dims, B.dims, C.dims)) || throw(DimensionMismatch("The quantum objects are not of the same Hilbert dimension."))
42+
allequal((L.dims, ψ0.dims, A.dims, B.dims, C.dims)) ||
43+
throw(DimensionMismatch("The quantum objects are not of the same Hilbert dimension."))
4344

4445
kwargs2 = merge((saveat = collect(tlist),), (; kwargs...))
4546
ρt = mesolve(L, ψ0, tlist; kwargs2...).states

src/deprecated.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ end
1616

1717
export FFTCorrelation
1818

19-
FFTCorrelation() = error("`FFTCorrelation` has been deprecated and will be removed in next major release, please use `spectrum_correlation_fft` to calculate the spectrum with FFT method instead.")
19+
FFTCorrelation() = error(
20+
"`FFTCorrelation` has been deprecated and will be removed in next major release, please use `spectrum_correlation_fft` to calculate the spectrum with FFT method instead.",
21+
)

src/spectrum.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ function spectrum(
4141
B::QuantumObject{<:AbstractArray{T3},OperatorQuantumObject};
4242
solver::SpectrumSolver = ExponentialSeries(),
4343
kwargs...,
44-
) where {
45-
MT1<:AbstractMatrix,
46-
T2,
47-
T3,
48-
HOpType<:Union{OperatorQuantumObject,SuperOperatorQuantumObject},
49-
}
44+
) where {MT1<:AbstractMatrix,T2,T3,HOpType<:Union{OperatorQuantumObject,SuperOperatorQuantumObject}}
5045
return _spectrum(liouvillian(H, c_ops), ωlist, A, B, solver; kwargs...)
5146
end
5247

@@ -77,7 +72,8 @@ function _spectrum(
7772
solver::ExponentialSeries;
7873
kwargs...,
7974
) where {T1,T2,T3}
80-
allequal((L.dims, A.dims, B.dims)) || throw(DimensionMismatch("The quantum objects are not of the same Hilbert dimension."))
75+
allequal((L.dims, A.dims, B.dims)) ||
76+
throw(DimensionMismatch("The quantum objects are not of the same Hilbert dimension."))
8177

8278
rates, vecs, ρss = _spectrum_get_rates_vecs_ss(L, solver)
8379

@@ -122,11 +118,11 @@ Calculate the power spectrum corresponding to a two-time correlation function us
122118
- `ωlist`: the list of angular frequencies ``\omega``.
123119
- `Slist`: the list of the power spectrum corresponding to the angular frequencies in `ωlist`.
124120
"""
125-
function spectrum_correlation_fft(tlist::AbstractVector, corr::AbstractVector; inverse::Bool=false)
121+
function spectrum_correlation_fft(tlist::AbstractVector, corr::AbstractVector; inverse::Bool = false)
126122
N = length(tlist)
127123
dt_list = diff(tlist)
128124
dt = dt_list[1]
129-
125+
130126
all((dt), dt_list) || ArgumentError("tlist must be equally spaced for FFT.")
131127

132128
# power spectrum list
@@ -137,4 +133,4 @@ function spectrum_correlation_fft(tlist::AbstractVector, corr::AbstractVector; i
137133
ωlist = 2 * π * fftshift(fftfreq(N, 1 / dt))
138134

139135
return ωlist, Slist
140-
end
136+
end

test/core-test/correlations_and_spectrum.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
t_l = range(0, 333 * π, length = 1000)
77
corr = correlation_2op_1t(H, nothing, t_l, c_ops, a', a; progress_bar = Val(false))
88
ω_l1, spec1 = spectrum_correlation_fft(t_l, corr)
9-
9+
1010
ω_l2 = range(0, 3, length = 1000)
1111
spec2 = spectrum(H, ω_l2, c_ops, a', a)
1212

0 commit comments

Comments
 (0)