Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 9bb2f37

Browse files
committed
style from scratch
1 parent c6a3871 commit 9bb2f37

11 files changed

Lines changed: 544 additions & 716 deletions

src/SparseDiffTools.jl

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,15 @@ export contract_color,
3434
autoauto_color_hessian,
3535
ForwardColorHesCache,
3636
ForwardAutoColorHesCache,
37-
auto_jacvec,
38-
auto_jacvec!,
39-
num_jacvec,
40-
num_jacvec!,
41-
num_vecjac,
42-
num_vecjac!,
43-
num_hesvec,
44-
num_hesvec!,
45-
numauto_hesvec,
46-
numauto_hesvec!,
47-
autonum_hesvec,
48-
autonum_hesvec!,
49-
num_hesvecgrad,
50-
num_hesvecgrad!,
51-
auto_hesvecgrad,
52-
auto_hesvecgrad!,
53-
JacVec,
54-
HesVec,
55-
HesVecGrad
37+
auto_jacvec, auto_jacvec!,
38+
num_jacvec, num_jacvec!,
39+
num_vecjac, num_vecjac!,
40+
num_hesvec, num_hesvec!,
41+
numauto_hesvec, numauto_hesvec!,
42+
autonum_hesvec, autonum_hesvec!,
43+
num_hesvecgrad, num_hesvecgrad!,
44+
auto_hesvecgrad, auto_hesvecgrad!,
45+
JacVec, HesVec, HesVecGrad
5646

5747
include("coloring/high_level.jl")
5848
include("coloring/backtracking_coloring.jl")
@@ -73,8 +63,8 @@ parameterless_type(x::Type) = __parameterless_type(x)
7363

7464
function __init__()
7565
@require Zygote="e88e6eb3-aa80-5325-afca-941959d7151f" begin
76-
export numback_hesvec,
77-
numback_hesvec!, autoback_hesvec, autoback_hesvec!, auto_vecjac, auto_vecjac!
66+
export numback_hesvec, numback_hesvec!, autoback_hesvec, autoback_hesvec!,
67+
auto_vecjac, auto_vecjac!
7868

7969
include("differentiation/vecjac_products_zygote.jl")
8070
include("differentiation/jaches_products_zygote.jl")

src/coloring/acyclic_coloring.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,8 @@ function color_graph(g::Graphs.AbstractGraph, ::AcyclicColoring)
3030
for x in outneighbors(g, w)
3131
if color[x] != 0
3232
if forbidden_colors[color[x]] != v
33-
prevent_cycle!(first_visit_to_tree,
34-
forbidden_colors,
35-
v,
36-
w,
37-
x,
38-
g,
39-
two_colored_forest,
40-
color)
33+
prevent_cycle!(first_visit_to_tree, forbidden_colors, v, w, x,
34+
g, two_colored_forest, color)
4135
end
4236
end
4337
end

src/coloring/backtracking_coloring.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,8 @@ end
189189
Returns least index i such that color of vertex
190190
A[i] is equal to `opt` (optimal chromatic number)
191191
"""
192-
function least_index(F::AbstractVector{<:Integer},
193-
A::AbstractVector{<:Integer},
194192
opt::Integer)
193+
function least_index(F::AbstractVector{<:Integer}, A::AbstractVector{<:Integer},
195194
for i in eachindex(A)
196195
if F[A[i]] == opt
197196
return i
@@ -205,8 +204,7 @@ end
205204
Uncolors all vertices A[i] where i is
206205
greater than or equal to start
207206
"""
208-
function uncolor_all!(F::AbstractVector{<:Integer},
209-
A::AbstractVector{<:Integer},
207+
function uncolor_all!(F::AbstractVector{<:Integer}, A::AbstractVector{<:Integer},
210208
start::Integer)
211209
for i in start:length(A)
212210
F[A[i]] = 0

src/differentiation/compute_hessian_ad.jl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,7 @@ function ForwardColorHesCache(f,
4343
if sparsity === nothing
4444
sparsity = sparse(ones(length(x), length(x)))
4545
end
46-
return ForwardColorHesCache(sparsity,
47-
colorvec,
48-
ncolors,
49-
D,
50-
buffer,
51-
g1!,
52-
grad_config,
53-
G,
46+
return ForwardColorHesCache(sparsity, colorvec, ncolors, D, buffer, g1!, grad_config, G,
5447
G2)
5548
end
5649

0 commit comments

Comments
 (0)