Skip to content

Commit 54e85c9

Browse files
authored
Add spell check CI and fix typos (#286)
* add spell check CI * fix version number * fix version number * add typo ignore * fix typos * minor changes
1 parent 9b23c6f commit 54e85c9

File tree

14 files changed

+77
-62
lines changed

14 files changed

+77
-62
lines changed

.github/workflows/SpellCheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Spell Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
typos-check:
7+
name: Spell Check with Typos
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Actions Repository
11+
uses: actions/checkout@v4
12+
- name: Check spelling
13+
uses: crate-ci/[email protected]

.typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[default.extend-words]
2+
ket = "ket"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ QuantumToolbox.jl is equipped with a robust set of features:
6565

6666
- **Quantum State and Operator Manipulation:** Easily handle quantum states and operators with a rich set of tools, with the same functionalities as QuTiP.
6767
- **Dynamical Evolution:** Advanced solvers for time evolution of quantum systems, thanks to the powerful [DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl) package.
68-
- **GPU Computing:** Leverage GPU resources for high-performance computing. For example, you run the master equation direclty on the GPU with the same syntax as the CPU case.
68+
- **GPU Computing:** Leverage GPU resources for high-performance computing. For example, you run the master equation directly on the GPU with the same syntax as the CPU case.
6969
- **Distributed Computing:** Distribute the computation over multiple nodes (e.g., a cluster). For example, you can run hundreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case.
7070
- **Easy Extension:** Easily extend the package, taking advantage of the Julia language features, like multiple dispatch and metaprogramming.
7171

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ QuantumToolbox.jl is equipped with a robust set of features:
1414

1515
- **Quantum State and Operator Manipulation:** Easily handle quantum states and operators with a rich set of tools, with the same functionalities as QuTiP.
1616
- **Dynamical Evolution:** Advanced solvers for time evolution of quantum systems, thanks to the powerful [DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl) package.
17-
- **GPU Computing:** Leverage GPU resources for high-performance computing. For example, you run the master equation direclty on the GPU with the same syntax as the CPU case.
17+
- **GPU Computing:** Leverage GPU resources for high-performance computing. For example, you run the master equation directly on the GPU with the same syntax as the CPU case.
1818
- **Distributed Computing:** Distribute the computation over multiple nodes (e.g., a cluster). For example, you can run undreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case.
1919
- **Easy Extension:** Easily extend the package, taking advantage of the Julia language features, like multiple dispatch and metaprogramming.
2020

docs/src/tutorials/lowrank.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# [Low rank master equation](@id doc-tutor:Low-rank-master-equation)
22

3-
In this tutorial, we will show how to solve the master equation using the low-rank method. For a detailed explaination of the method, we recommend to read the article [gravina2024adaptive](@cite).
3+
In this tutorial, we will show how to solve the master equation using the low-rank method. For a detailed explanation of the method, we recommend to read the article [gravina2024adaptive](@cite).
44

55
As a test, we will consider the dissipative Ising model with a transverse field. The Hamiltonian is given by
66

docs/src/users_guide/states_and_operators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ We can also create superpositions of states:
9999
ket = normalize(basis(5, 0) + basis(5, 1))
100100
```
101101

102-
where we have used the `normalize` function again to normalize the state. Apply the number opeartor again:
102+
where we have used the `normalize` function again to normalize the state. Apply the number operator again:
103103

104104
```@example states_and_operators
105105
n * ket

src/linear_maps.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ A **linear map** is a transformation `L` that satisfies:
1818
L(cu) = cL(u)
1919
```
2020
21-
It is typically represented as a matrix with dimensions given by `size`, and this abtract type helps to define this map when the matrix is not explicitly available.
21+
It is typically represented as a matrix with dimensions given by `size`, and this abstract type helps to define this map when the matrix is not explicitly available.
2222
2323
## Methods
2424

src/qobj/arithmetic_and_attributes.jl

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -511,17 +511,17 @@ Quantum Object: type=Operator dims=[2] size=(2, 2) ishermitian=true
511511
function ptrace(QO::QuantumObject{<:AbstractArray,KetQuantumObject}, sel::Union{AbstractVector{Int},Tuple})
512512
_non_static_array_warning("sel", sel)
513513

514-
ns = length(sel)
515-
if ns == 0 # return full trace for empty sel
514+
n_s = length(sel)
515+
if n_s == 0 # return full trace for empty sel
516516
return tr(ket2dm(QO))
517517
else
518-
nd = length(QO.dims)
518+
n_d = length(QO.dims)
519519

520-
(any(>(nd), sel) || any(<(1), sel)) && throw(
521-
ArgumentError("Invalid indices in `sel`: $(sel), the given QuantumObject only have $(nd) sub-systems"),
520+
(any(>(n_d), sel) || any(<(1), sel)) && throw(
521+
ArgumentError("Invalid indices in `sel`: $(sel), the given QuantumObject only have $(n_d) sub-systems"),
522522
)
523-
(ns != length(unique(sel))) && throw(ArgumentError("Duplicate selection indices in `sel`: $(sel)"))
524-
(nd == 1) && return ket2dm(QO) # ptrace should always return Operator
523+
(n_s != length(unique(sel))) && throw(ArgumentError("Duplicate selection indices in `sel`: $(sel)"))
524+
(n_d == 1) && return ket2dm(QO) # ptrace should always return Operator
525525
end
526526

527527
_sort_sel = sort(SVector{length(sel),Int}(sel))
@@ -534,17 +534,17 @@ ptrace(QO::QuantumObject{<:AbstractArray,BraQuantumObject}, sel::Union{AbstractV
534534
function ptrace(QO::QuantumObject{<:AbstractArray,OperatorQuantumObject}, sel::Union{AbstractVector{Int},Tuple})
535535
_non_static_array_warning("sel", sel)
536536

537-
ns = length(sel)
538-
if ns == 0 # return full trace for empty sel
537+
n_s = length(sel)
538+
if n_s == 0 # return full trace for empty sel
539539
return tr(QO)
540540
else
541-
nd = length(QO.dims)
541+
n_d = length(QO.dims)
542542

543-
(any(>(nd), sel) || any(<(1), sel)) && throw(
544-
ArgumentError("Invalid indices in `sel`: $(sel), the given QuantumObject only have $(nd) sub-systems"),
543+
(any(>(n_d), sel) || any(<(1), sel)) && throw(
544+
ArgumentError("Invalid indices in `sel`: $(sel), the given QuantumObject only have $(n_d) sub-systems"),
545545
)
546-
(ns != length(unique(sel))) && throw(ArgumentError("Duplicate selection indices in `sel`: $(sel)"))
547-
(nd == 1) && return QO
546+
(n_s != length(unique(sel))) && throw(ArgumentError("Duplicate selection indices in `sel`: $(sel)"))
547+
(n_d == 1) && return QO
548548
end
549549

550550
_sort_sel = sort(SVector{length(sel),Int}(sel))
@@ -554,61 +554,61 @@ end
554554
ptrace(QO::QuantumObject, sel::Int) = ptrace(QO, SVector(sel))
555555

556556
function _ptrace_ket(QO::AbstractArray, dims::Union{SVector,MVector}, sel)
557-
nd = length(dims)
557+
n_d = length(dims)
558558

559-
nd == 1 && return QO, dims
559+
n_d == 1 && return QO, dims
560560

561-
qtrace = filter(i -> i sel, 1:nd)
561+
qtrace = filter(i -> i sel, 1:n_d)
562562
dkeep = dims[sel]
563563
dtrace = dims[qtrace]
564-
nt = length(dtrace)
564+
n_t = length(dtrace)
565565

566566
# Concatenate qtrace and sel without losing the length information
567567
# Tuple(qtrace..., sel...)
568-
qtrace_sel = ntuple(Val(nd)) do i
569-
if i <= nt
568+
qtrace_sel = ntuple(Val(n_d)) do i
569+
if i <= n_t
570570
@inbounds qtrace[i]
571571
else
572-
@inbounds sel[i-nt]
572+
@inbounds sel[i-n_t]
573573
end
574574
end
575575

576576
vmat = reshape(QO, reverse(dims)...)
577-
topermute = reverse(nd + 1 .- qtrace_sel)
577+
topermute = reverse(n_d + 1 .- qtrace_sel)
578578
vmat = permutedims(vmat, topermute) # TODO: use PermutedDimsArray when Julia v1.11.0 is released
579579
vmat = reshape(vmat, prod(dkeep), prod(dtrace))
580580

581581
return vmat * vmat', dkeep
582582
end
583583

584584
function _ptrace_oper(QO::AbstractArray, dims::Union{SVector,MVector}, sel)
585-
nd = length(dims)
585+
n_d = length(dims)
586586

587-
nd == 1 && return QO, dims
587+
n_d == 1 && return QO, dims
588588

589-
qtrace = filter(i -> i sel, 1:nd)
589+
qtrace = filter(i -> i sel, 1:n_d)
590590
dkeep = dims[sel]
591591
dtrace = dims[qtrace]
592-
nk = length(dkeep)
593-
nt = length(dtrace)
594-
_2_nt = 2 * nt
592+
n_k = length(dkeep)
593+
n_t = length(dtrace)
594+
_2_n_t = 2 * n_t
595595

596596
# Concatenate qtrace and sel without losing the length information
597597
# Tuple(qtrace..., sel...)
598-
qtrace_sel = ntuple(Val(2 * nd)) do i
599-
if i <= nt
598+
qtrace_sel = ntuple(Val(2 * n_d)) do i
599+
if i <= n_t
600600
@inbounds qtrace[i]
601-
elseif i <= _2_nt
602-
@inbounds qtrace[i-nt] + nd
603-
elseif i <= _2_nt + nk
604-
@inbounds sel[i-_2_nt]
601+
elseif i <= _2_n_t
602+
@inbounds qtrace[i-n_t] + n_d
603+
elseif i <= _2_n_t + n_k
604+
@inbounds sel[i-_2_n_t]
605605
else
606-
@inbounds sel[i-_2_nt-nk] + nd
606+
@inbounds sel[i-_2_n_t-n_k] + n_d
607607
end
608608
end
609609

610610
ρmat = reshape(QO, reverse(vcat(dims, dims))...)
611-
topermute = reverse(2 * nd + 1 .- qtrace_sel)
611+
topermute = reverse(2 * n_d + 1 .- qtrace_sel)
612612
ρmat = permutedims(ρmat, topermute) # TODO: use PermutedDimsArray when Julia v1.11.0 is released
613613
ρmat = reshape(ρmat, prod(dkeep), prod(dkeep), prod(dtrace), prod(dtrace))
614614
res = map(tr, eachslice(ρmat, dims = (1, 2)))

src/qobj/boolean_functions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ SciMLOperators.iscached(A::AbstractQuantumObject) = iscached(A.data)
100100
@doc raw"""
101101
SciMLOperators.isconstant(A::AbstractQuantumObject)
102102
103-
Test whether the [`AbstractQuantumObject`](@ref) `A` is constant in time. For a [`QuantumObject`](@ref), this function returns `true`, while for a [`QuantumObjectEvolution`](@ref), this function returns `true` if the operator is contant in time.
103+
Test whether the [`AbstractQuantumObject`](@ref) `A` is constant in time. For a [`QuantumObject`](@ref), this function returns `true`, while for a [`QuantumObjectEvolution`](@ref), this function returns `true` if the operator is constant in time.
104104
"""
105105
SciMLOperators.isconstant(A::AbstractQuantumObject) = isconstant(A.data)

src/qobj/superoperators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function _sprepost(A, B) # for any other input types
2020
end
2121

2222
## if input is AbstractSciMLOperator
23-
## some of them are optimzed to speed things up
23+
## some of them are optimized to speed things up
2424
## the rest of the SciMLOperators will just use lazy tensor (and prompt a warning)
2525
_spre(A::MatrixOperator, Id::AbstractMatrix) = MatrixOperator(_spre(A.A, Id))
2626
_spre(A::ScaledOperator, Id::AbstractMatrix) = ScaledOperator(A.λ, _spre(A.L, Id))

0 commit comments

Comments
 (0)