Skip to content

Commit

Permalink
🤖 Format .jl files (#352)
Browse files Browse the repository at this point in the history
Co-authored-by: tmigot <[email protected]>
  • Loading branch information
github-actions[bot] and tmigot authored Nov 2, 2024
1 parent 5fe2781 commit a853733
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
36 changes: 18 additions & 18 deletions .breakage/get_jso_users.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import GitHub, PkgDeps # both export users()

length(ARGS) >= 1 || error("specify at least one JSO package as argument")

jso_repos, _ = GitHub.repos("JuliaSmoothOptimizers")
jso_names = [splitext(x.name)[1] for x jso_repos]

name = splitext(ARGS[1])[1]
name jso_names || error("argument should be one of ", jso_names)

dependents = String[]
try
global dependents = filter(x -> x jso_names, PkgDeps.users(name))
catch e
# package not registered; don't insert into dependents
end

println(dependents)
import GitHub, PkgDeps # both export users()

length(ARGS) >= 1 || error("specify at least one JSO package as argument")

jso_repos, _ = GitHub.repos("JuliaSmoothOptimizers")
jso_names = [splitext(x.name)[1] for x jso_repos]

name = splitext(ARGS[1])[1]
name jso_names || error("argument should be one of ", jso_names)

dependents = String[]
try
global dependents = filter(x -> x jso_names, PkgDeps.users(name))
catch e
# package not registered; don't insert into dependents
end

println(dependents)
8 changes: 4 additions & 4 deletions src/cat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function hcat_prod!(
β,
) where {T, I <: Integer}
mul!(res, A, view(v, 1:Ancol), α, β)
mul!(res, B, view(v, (Ancol+1):nV), α, one(T))
mul!(res, B, view(v, (Ancol + 1):nV), α, one(T))
end

function hcat_ctprod!(
Expand All @@ -29,7 +29,7 @@ function hcat_ctprod!(
β,
) where {T, I <: Integer}
mul!(view(res, 1:Ancol), A, u, α, β)
mul!(view(res, (Ancol+1):nV), B, u, α, β)
mul!(view(res, (Ancol + 1):nV), B, u, α, β)
end

function hcat(A::AbstractLinearOperator, B::AbstractLinearOperator)
Expand Down Expand Up @@ -74,7 +74,7 @@ function vcat_prod!(
β,
) where {T, I <: Integer}
mul!(view(res, 1:Anrow), A, u, α, β)
mul!(view(res, (Anrow+1):nV), B, u, α, β)
mul!(view(res, (Anrow + 1):nV), B, u, α, β)
end

function vcat_ctprod!(
Expand All @@ -88,7 +88,7 @@ function vcat_ctprod!(
β,
) where {T, I <: Integer}
mul!(res, A, view(v, 1:Anrow), α, β)
mul!(res, B, view(v, (Anrow+1):nV), α, one(T))
mul!(res, B, view(v, (Anrow + 1):nV), α, one(T))
end

function vcat(A::AbstractLinearOperator, B::AbstractLinearOperator)
Expand Down
2 changes: 1 addition & 1 deletion src/lbfgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function push_common!(
if data.ys[k] != 0
@. data.a[k] = data.s[k] / data.scaling_factor # B₀ = I / γ.

for j = 1:(i-1)
for j = 1:(i - 1)
l = mod(insert + j - 1, data.mem) + 1
if data.ys[l] != 0
data.a[k] .+= dot(data.b[l], data.s[k]) .* data.b[l]
Expand Down
2 changes: 1 addition & 1 deletion src/lsr1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function push!(op::LSR1Operator, s::AbstractVector, y::AbstractVector)
k = mod(data.insert + i - 2, data.mem) + 1
if data.ys[k] != 0
data.a[k] .= data.y[k] - data.s[k] / data.scaling_factor # = y - B₀ * s
for j = 1:(i-1)
for j = 1:(i - 1)
l = mod(data.insert + j - 2, data.mem) + 1
if data.ys[l] != 0
as = dot(data.a[l], data.s[k]) / data.as[l]
Expand Down
2 changes: 1 addition & 1 deletion src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function solve_shifted_system!(
@. data.shifted_p[:, i] = x_0 * data.shifted_u

sign_t = 1
for t = 1:(i-1)
for t = 1:(i - 1)
c0 = dot(view(data.shifted_p, :, t), data.shifted_u)
c1 = sign_t .* data.shifted_v[t]
c2 = c1 * c0
Expand Down
4 changes: 2 additions & 2 deletions test/test_lbfgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function test_lbfgs()

# Insert a few {s,y} pairs.
insert = 0
for i = 1:(mem+2)
for i = 1:(mem + 2)
s = ones(n) * i
y = [i; ones(n - 1)]
if dot(s, y) > 1.0e-20
Expand Down Expand Up @@ -100,7 +100,7 @@ function test_lbfgs()
H = InverseLBFGSOperator(n, mem = mem, damped = true, scaling = false, σ₂ = 0.8, σ₃ = Inf)

insert_B = insert_H = 0
for i = 1:(mem+2)
for i = 1:(mem + 2)
s = simple_vector(Float64, n)
y = simple_vector(Float64, n)
ys = dot(y, s)
Expand Down
2 changes: 1 addition & 1 deletion test/test_linop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function test_linop()
op = H * opDiagonal(Λ) * H'
@test check_positive_definite(op)
@test check_positive_definite(op, semi = true)
Λ = collect(eltype(v), 0:(nrow-1))
Λ = collect(eltype(v), 0:(nrow - 1))
op = H * opDiagonal(Λ) * H'
@test check_positive_definite(op, semi = true)
A = Matrix(op)
Expand Down
2 changes: 1 addition & 1 deletion test/test_lsr1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function test_lsr1()
@test B.data.insert == 1

# Insert a few {s,y} pairs.
for i = 1:(mem+2)
for i = 1:(mem + 2)
s = ones(n) * i
y = [i; ones(n - 1)]
push!(B, s, y)
Expand Down

0 comments on commit a853733

Please sign in to comment.