Skip to content

[Coloring] Fix docstrings #2622

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

Merged
merged 1 commit into from
Feb 11, 2025
Merged
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
12 changes: 7 additions & 5 deletions src/Nonlinear/ReverseAD/Coloring/Coloring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
nnz::Int
end

Represent the set `nzidx[1:nnz]` by additionally setting `empty[i]` to `true`
for each element of the set for fast membership check.
Represent the set `nzidx[1:nnz]` by additionally setting `empty[i]` to `false`
for each element `i` of the set for fast membership check.
"""
mutable struct IndexedSet
nzidx::Vector{Int}
Expand All @@ -44,6 +44,8 @@
return v
end

# Returns the maximum index that the set can contain,
# not the cardinality of the set like `length(::Base.Set)`
Base.length(v::IndexedSet) = length(v.nzidx)

function Base.resize!(v::IndexedSet, n::Integer)
Expand Down Expand Up @@ -75,8 +77,8 @@

Compact storage for an undirected graph. The number of nodes is given by
`length(offsets) - 1`. The edges of node `u` are given by `edges[e]` for
`e in edgeindex[offsets[u]:(offsets[u] - 1)]`. The neighbors are also
stored at `adjlist[offsets[u]:(offsets[u] - 1)]`.
`e in edgeindex[offsets[u]:(offsets[u+1] - 1)]`. The neighbors are also
stored at `adjlist[offsets[u]:(offsets[u+1] - 1)]`.
"""
struct UndirectedGraph
adjlist::Vector{Int}
Expand Down Expand Up @@ -473,7 +475,7 @@
push!(I, i)
push!(J, j)
end
local_indices = sort!(seen_idx.nzidx[1:seen_idx.nnz])
local_indices = sort!(collect(seen_idx))

Check warning on line 478 in src/Nonlinear/ReverseAD/Coloring/Coloring.jl

View check run for this annotation

Codecov / codecov/patch

src/Nonlinear/ReverseAD/Coloring/Coloring.jl#L478

Added line #L478 was not covered by tests
empty!(seen_idx)
global_to_local_idx = seen_idx.nzidx # steal for storage
for k in eachindex(local_indices)
Expand Down
Loading