From 1c8da76620709f6287064b4c01d20ccb333aca50 Mon Sep 17 00:00:00 2001 From: dpo <38760+dpo@users.noreply.github.com> Date: Wed, 16 Oct 2024 22:47:04 +0000 Subject: [PATCH] :robot: Format .jl files --- .breakage/get_jso_users.jl | 4 ++-- src/cat.jl | 8 ++++---- src/lbfgs.jl | 2 +- src/lsr1.jl | 2 +- src/utilities.jl | 2 +- test/test_lbfgs.jl | 4 ++-- test/test_linop.jl | 2 +- test/test_lsr1.jl | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.breakage/get_jso_users.jl b/.breakage/get_jso_users.jl index 305dd1db..0d87f552 100644 --- a/.breakage/get_jso_users.jl +++ b/.breakage/get_jso_users.jl @@ -10,9 +10,9 @@ name ∈ jso_names || error("argument should be one of ", jso_names) dependents = String[] try - global dependents = filter(x -> x ∈ jso_names, PkgDeps.users(name)) + global dependents = filter(x -> x ∈ jso_names, PkgDeps.users(name)) catch e - # package not registered; don't insert into dependents + # package not registered; don't insert into dependents end println(dependents) diff --git a/src/cat.jl b/src/cat.jl index 764c7893..b0f821f1 100644 --- a/src/cat.jl +++ b/src/cat.jl @@ -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!( @@ -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) @@ -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!( @@ -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) diff --git a/src/lbfgs.jl b/src/lbfgs.jl index 1b3177dc..3154ecd3 100644 --- a/src/lbfgs.jl +++ b/src/lbfgs.jl @@ -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] diff --git a/src/lsr1.jl b/src/lsr1.jl index 9967b4db..2445062e 100644 --- a/src/lsr1.jl +++ b/src/lsr1.jl @@ -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] diff --git a/src/utilities.jl b/src/utilities.jl index 70b0dedd..0a26795f 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -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 diff --git a/test/test_lbfgs.jl b/test/test_lbfgs.jl index 250cec9a..5d91416a 100644 --- a/test/test_lbfgs.jl +++ b/test/test_lbfgs.jl @@ -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 @@ -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) diff --git a/test/test_linop.jl b/test/test_linop.jl index 71039448..0630ac66 100644 --- a/test/test_linop.jl +++ b/test/test_linop.jl @@ -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) diff --git a/test/test_lsr1.jl b/test/test_lsr1.jl index 2fb9a93a..23468a1c 100644 --- a/test/test_lsr1.jl +++ b/test/test_lsr1.jl @@ -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)