Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add spelling CI #231

Merged
merged 7 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/benchmark-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# check if the previous comment exists
- name: find comment
uses: peter-evans/find-comment@v2
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ steps.output-pull-request-number.outputs.body }}
Expand All @@ -52,13 +52,13 @@ jobs:
# create/update comment
- name: create comment
if: ${{ steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.output-pull-request-number.outputs.body }}
body: ${{ steps.output-result-markdown.outputs.body }}
- name: update comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: ${{ steps.output-result-markdown.outputs.body }}
15 changes: 15 additions & 0 deletions .github/workflows/changelog-enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Changelog Enforcer"
on:
pull_request:
# The specific activity types are listed here to include "labeled" and "unlabeled"
# (which are not included by default for the "pull_request" trigger).
# This is needed to allow skipping enforcement of the changelog in PRs with specific labels,
# as defined in the (optional) "skipLabels" property.
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
# Enforces the update of a changelog file on every pull request
changelog:
runs-on: ubuntu-latest
steps:
- uses: dangoslen/changelog-enforcer@v3
5 changes: 3 additions & 2 deletions .github/workflows/ci-julia-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
JULIA_NUM_THREADS: ${{ matrix.threads }}
JET_TEST: ${{ matrix.jet }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
file: lcov.info
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ jobs:
env:
JULIA_NUM_THREADS: ${{ matrix.threads }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
docs:
name: Documentation
runs-on: ubuntu-latest
Expand All @@ -46,6 +47,9 @@ jobs:
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: "Manually add Conda.jl folder due to bug in its build step"
run: |
mkdir -p "/home/runner/.julia/conda/3/x86_64"
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@master
with:
config: .typos.toml
7 changes: 7 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[default.extend-words]
ket = "ket"

[type.ipynb]
# It detects false possitives in the base64 encoded images inside notebooks
extend-glob = ["*.ipynb"]
check-file = false
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@

## v0.5.5 - 2022-07-05

- **(breaking fix)** `CliffordOperator` constructor called on a square tableau occasionally resulted in incorrect results due to row-reordering during cannonicalization.
- **(breaking fix)** `CliffordOperator` constructor called on a square tableau occasionally resulted in incorrect results due to row-reordering during canonicalization.
- Continuing static analysis fixes thanks to JET.
- Optimization of `canonicalize_clip!`, now resulting in much fewer allocations.

Expand Down
4 changes: 2 additions & 2 deletions benchmark/run_benchmark_matrix.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ for jlversion in nightly 1.10.0 1.9.0 1.8.0 1.7.0 1.6.0
for tag in (git for-each-ref --sort=creatordate --format '%(tag)' refs/tags | tail -n+15)
for nthreads in 1 4
for retune in true
./run_ttfx_bechmarks.sh -v$jlversion -t$tag -n$nthreads
./run_bechmarks.sh -v$jlversion -t$tag -n$nthreads -r$retune
./run_ttfx_benchmarks.sh -v$jlversion -t$tag -n$nthreads
./run_benchmarks.sh -v$jlversion -t$tag -n$nthreads -r$retune
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion docs/src/datastructures.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Notice the results when the projection operator commutes with the state but is n

## [Bit Packing in Integers and Array Order](@id Bit-Packing-in-Integers-and-Array-Order)

We do not use boolean arrays to store information about the qubits as this would be wasteful (7 out of 8 bits in the boolean would be unused). Instead, we use all 8 qubits in a byte and peform bitwise logical operations as necessary. Implementation details of the object in RAM can matter for performance. The library permits any of the standard `UInt` types to be used for packing the bits, and larger `UInt` types (like `UInt64`) are usually faster as they permit working on 64 qubits at a time (instead of 1 if we used a boolean, or 8 if we used a byte).
We do not use boolean arrays to store information about the qubits as this would be wasteful (7 out of 8 bits in the boolean would be unused). Instead, we use all 8 qubits in a byte and perform bitwise logical operations as necessary. Implementation details of the object in RAM can matter for performance. The library permits any of the standard `UInt` types to be used for packing the bits, and larger `UInt` types (like `UInt64`) are usually faster as they permit working on 64 qubits at a time (instead of 1 if we used a boolean, or 8 if we used a byte).

Moreover, how a tableau is stored in memory can affect performance, as a row-major storage
usually permits more efficient use of the CPU cache (for the particular algorithms we use).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/stab-algebra-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The library consists of two main parts: Tools for working with the algebra of St

# Pauli Operators

The [`PauliOperator`](@ref) object representes multi-qubit Pauli operator
The [`PauliOperator`](@ref) object represents multi-qubit Pauli operator
(``±\{1,i\}\{I,Z,X,Y\}^{\otimes n}``). It is stored in memory as a phase (a
single byte where `0x0,0x1,0x2,0x3` corresponds to $1,i,-1,-i$) and two
bit-arrays, for X and for Z components.
Expand Down
12 changes: 6 additions & 6 deletions ext/QuantumCliffordGPUExt/adapters.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
const InnerGPUType = UInt32;
const InnerCPUType = UInt64;

# todo. make the conversion types consiting with this...
# TODO make the conversion types consistent with this...
# also define a cpu default type?!

to_gpu(array::AbstractArray) = CuArray(array)
to_cpu(array::AbstractArray) = Array(array);

# changes the type to InnerGPUType or InnerCPUType as well as copying to cpu/gpu
to_gpu(array::AbstractArray, tp::Type{T}) where {T <: Unsigned} =
to_gpu(array::AbstractArray, tp::Type{T}) where {T <: Unsigned} =
CuArray(reinterpret(T, collect(array)))
to_cpu(array::AbstractArray, tp::Type{T}) where {T <: Unsigned} =
to_cpu(array::AbstractArray, tp::Type{T}) where {T <: Unsigned} =
Array(reinterpret(T, collect(array)))

# maybe change the format of storing the data in gpu array
# so that it is more convinient to work with them on gpu?
# maybe change the format of storing the data in gpu array
# so that it is more convenient to work with them on gpu?
# todo later add some type checking to avoid copying (or throw error) if the data is already on gpu/cpu
to_gpu(tab::QuantumClifford.Tableau, tp::Type{T}=InnerGPUType) where {T <: Unsigned} =
QuantumClifford.Tableau(to_gpu(tab.phases), tab.nqubits, to_gpu(tab.xzs, tp))
Expand All @@ -31,7 +31,7 @@ to_cpu(pauli::QuantumClifford.PauliOperator, tp::Type{T}=InnerCPUType) where {T
to_gpu(stabilizer::QuantumClifford.Stabilizer, tp::Type{T}=InnerGPUType) where {T <: Unsigned} =
Stabilizer(to_gpu(tab(stabilizer), tp))

to_cpu(stabilizer::QuantumClifford.Stabilizer, tp::Type{T}=InnerCPUType) where {T <: Unsigned} =
to_cpu(stabilizer::QuantumClifford.Stabilizer, tp::Type{T}=InnerCPUType) where {T <: Unsigned} =
Stabilizer(to_cpu(tab(stabilizer), tp))

to_gpu(pauli_frame::QuantumClifford.PauliFrame, tp::Type{T}=InnerGPUType) where {T <: Unsigned} =
Expand Down
2 changes: 1 addition & 1 deletion src/QuantumClifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Base.iterate(tab::Tableau, state::Int=1) = state>length(tab) ? nothing : (tab[st

function Base.setindex!(tab::Tableau, pauli::PauliOperator, i)
tab.phases[i] = pauli.phase[]
#tab.xzs[:,i] = pauli.xz # TODO why is this assigment causing allocations
#tab.xzs[:,i] = pauli.xz # TODO why is this assignment causing allocations
for j in 1:length(pauli.xz)
tab.xzs[j,i] = pauli.xz[j]
end
Expand Down
2 changes: 1 addition & 1 deletion src/ecc/decoder_pipeline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function physical_ECC_circuit end # XXX Do not export! This might need to be ref

"""Configuration for ECC evaluator that does not simulate any ECC circuits, rather it simply checks the commutation of the parity check and the Pauli error.

This is much faster than any other simulation method, but it is incapable of noisy-circuit simulations and thus useless for fault-tollerance studies.
This is much faster than any other simulation method, but it is incapable of noisy-circuit simulations and thus useless for fault-tolerance studies.

See also: [`NaiveSyndromeECCSetup`](@ref), [`ShorSyndromeECCSetup`](@ref)"""
struct CommutationCheckECCSetup <: AbstractECCSetup
Expand Down
2 changes: 1 addition & 1 deletion src/enumeration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ end
for i in padded_n+δn+start:2padded_n+1
comm(basis, δn+start, i)==0x1 && return i
end
# the following hapens only if the input is P"X___..."
# the following happens only if the input is P"X___..."
rowswap!(basis, δn+start, 2padded_n+1; phases=Val(false))
_findanticommGS(basis, start, n, padded_n, δn)
end
Expand Down
2 changes: 1 addition & 1 deletion src/graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ julia> z_idx
```

The `Graphs.jl` library provides many graph-theory tools and the
`MakieGraphs.jl` library provides plotting utilies for graphs.
`MakieGraphs.jl` library provides plotting utilities for graphs.

You can directly call the graph constructor on a stabilizer,
if you just want the graph and do not care about the Clifford
Expand Down
2 changes: 1 addition & 1 deletion src/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ LinearAlgebra.rank(s::Destabilizer) = throw(BadDataStructure("Using a `Destabili
LinearAlgebra.rank(s::MixedStabilizer) = s.rank
LinearAlgebra.rank(s::MixedDestabilizer) = s.rank

"""A "trusted" `rank` which returns `rank(state)` for `Mixed[De]Stabilizer` and `lenght(state)` for `[De]Stabilizer`."""
"""A "trusted" `rank` which returns `rank(state)` for `Mixed[De]Stabilizer` and `length(state)` for `[De]Stabilizer`."""
function trusted_rank end
trusted_rank(s::Stabilizer) = length(s)
trusted_rank(s::Destabilizer) = length(s)
Expand Down
2 changes: 1 addition & 1 deletion src/misc_ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ end
operatordeterminism(::Type{VerifyOp}) = DeterministicOperatorTrait()

abstract type ClassicalXORConcreteWorkaround <: AbstractOperation end # See below for more of this abomination - replace everywhere by ClassicalXOR when compactification is fixed
"""Applies an XOR gate to classical bits. Currently only implemented for funcitonality with pauli frames."""
"""Applies an XOR gate to classical bits. Currently only implemented for functionality with pauli frames."""
struct ClassicalXOR{N} <: ClassicalXORConcreteWorkaround
"The indices of the classical bits to be xor-ed"
bits::NTuple{N,Int}
Expand Down
2 changes: 1 addition & 1 deletion src/noise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function apply!(s::AbstractQCState, mr::NoiseOp)
return applynoise!(s, mr.noise, affectedqubits(mr))
end

# XXX necessary to resolve ambiguitiy between apply!(s::AbstractQCState, mr::Noise) and apply!(r::Register, op)
# XXX necessary to resolve ambiguity between apply!(s::AbstractQCState, mr::Noise) and apply!(r::Register, op)
# TODO resolve them in a neater fashion with less repetition
function apply!(r::Register, n::NoisyGate)
apply!(quantumstate(r), n)
Expand Down
2 changes: 1 addition & 1 deletion src/pauli_frames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ $(TYPEDSIGNATURES)

Returns the measurement results for each frame in the [`PauliFrame`](@ref) instance.

!!! warning "Relative mesurements"
!!! warning "Relative measurements"
The return measurements are relative to the reference measurements, i.e. they only say
whether the reference measurements have been flipped in the given frame.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/petrajectory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function petrajectory_keep(state, circuit; branch_weight=1.0, current_order=0, m
return dict
end

"""Run a perturbative expansion to a given order. This is the main public fuction for the perturbative expansion approach.
"""Run a perturbative expansion to a given order. This is the main public function for the perturbative expansion approach.

See also: [`pftrajectories`](@ref), [`mctrajectories`](@ref)"""
function petrajectories(initialstate, circuit; branch_weight=1.0, max_order=1, keepstates::Bool=false)
Expand Down
4 changes: 2 additions & 2 deletions src/project_trace_reset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ function reset_qubits!(s::Stabilizer, newstate, qubits; phases=true)
s, x, z = canonicalize!(s,ranks=true) # TODO this is unnecessary, but it provides for nicely formatted tableaux; consider removing it for speed reasons
_, rref_i = canonicalize_rref!((@view s[1:z]),qubits,phases=phases)
for row in 1:length(newstate)
s[row+rref_i] = _expand_pauli(newstate[row], qubits, n) # TODO do something that does not alocate temporary arrays
s[row+rref_i] = _expand_pauli(newstate[row], qubits, n) # TODO do something that does not allocate temporary arrays
end
for row in rref_i+length(newstate)+1:z
zero!(s,row)
Expand All @@ -686,7 +686,7 @@ function reset_qubits!(s::MixedStabilizer, newstate, qubits; phases=true) # TODO
sv = stabilizerview(s)
sv, rref_i = canonicalize_rref!(sv,qubits,phases=phases)
for row in 1:length(newstate)
s.tab[row+rref_i] = _expand_pauli(newstate[row], qubits, n) # TODO do something that does not alocate temporary arrays
s.tab[row+rref_i] = _expand_pauli(newstate[row], qubits, n) # TODO do something that does not allocate temporary arrays
end
s.rank = rref_i+length(newstate)
s
Expand Down
4 changes: 2 additions & 2 deletions test/test_symcontrolled.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ function transform_Xbasis(qubit)
end

function get_gates(control, target)
transform1, inverse1 = transform_Zbasis(1) # get gates which swith control from Z basis to specified
transform2, inverse2 = transform_Xbasis(2) # get gates which swith control from X basis to specified
transform1, inverse1 = transform_Zbasis(1)
transform2, inverse2 = transform_Xbasis(2)
return [transform1[control]..., transform2[target]...], [inverse2[target]..., inverse1[control]...]
end

Expand Down
Loading