Skip to content

Commit 4e41991

Browse files
authored
Merge pull request #5 from JuliaOptimizationVariationalAnalysis/auto-juliaformatter-pr
[AUTO] JuliaFormatter.jl run
2 parents 1a4e641 + 484c860 commit 4e41991

File tree

6 files changed

+73
-38
lines changed

6 files changed

+73
-38
lines changed

docs/make.jl

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
using VariationalInequalitySolver
22
using Documenter
33

4-
DocMeta.setdocmeta!(VariationalInequalitySolver, :DocTestSetup, :(using VariationalInequalitySolver); recursive=true)
4+
DocMeta.setdocmeta!(
5+
VariationalInequalitySolver,
6+
:DocTestSetup,
7+
:(using VariationalInequalitySolver);
8+
recursive = true,
9+
)
510

611
makedocs(;
7-
modules=[VariationalInequalitySolver],
8-
authors="Tangi Migot [email protected]",
9-
repo="https://github.com/JuliaOptimizationVariationalAnalysis/VariationalInequalitySolver.jl/blob/{commit}{path}#{line}",
10-
sitename="VariationalInequalitySolver.jl",
11-
format=Documenter.HTML(;
12-
prettyurls=get(ENV, "CI", "false") == "true",
13-
canonical="https://JuliaOptimizationVariationalAnalysis.github.io/VariationalInequalitySolver.jl",
14-
assets=String[],
15-
),
16-
pages=[
17-
"Home" => "index.md",
18-
],
12+
modules = [VariationalInequalitySolver],
13+
authors = "Tangi Migot [email protected]",
14+
repo = "https://github.com/JuliaOptimizationVariationalAnalysis/VariationalInequalitySolver.jl/blob/{commit}{path}#{line}",
15+
sitename = "VariationalInequalitySolver.jl",
16+
format = Documenter.HTML(;
17+
prettyurls = get(ENV, "CI", "false") == "true",
18+
canonical = "https://JuliaOptimizationVariationalAnalysis.github.io/VariationalInequalitySolver.jl",
19+
assets = String[],
20+
),
21+
pages = ["Home" => "index.md"],
1922
)
2023

2124
deploydocs(;
22-
repo="github.com/JuliaOptimizationVariationalAnalysis/VariationalInequalitySolver.jl",
23-
devbranch="main",
25+
repo = "github.com/JuliaOptimizationVariationalAnalysis/VariationalInequalitySolver.jl",
26+
devbranch = "main",
2427
)

src/VariationalInequalitySolver.jl

+24-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@ module VariationalInequalitySolver
22

33
using FastClosures, LinearAlgebra, Logging, NLPModels, Stopping
44

5-
import NLPModels: residual!, jac_structure_residual!, jac_coord_residual!, jprod_residual!, jtprod_residual!, jac_op_residual!, hess_structure_residual!, hess_coord_residual!, hprod_residual!, hess_op_residual!
6-
5+
import NLPModels:
6+
residual!,
7+
jac_structure_residual!,
8+
jac_coord_residual!,
9+
jprod_residual!,
10+
jtprod_residual!,
11+
jac_op_residual!,
12+
hess_structure_residual!,
13+
hess_coord_residual!,
14+
hprod_residual!,
15+
hess_op_residual!
716

817
abstract type AbstractVIModel{T, S} end
918

@@ -29,12 +38,23 @@ mutable struct NLSVIModel{S, T, NLP <: AbstractNLSModel{T, S}} <: AbstractVIMode
2938
@lencheck nls.nls_meta.nequ nls.meta.x0 #test that nls.meta.nvar == nls.nls_meta.nequ
3039
return new{S, T, typeof(nls)}(
3140
VIMeta{T, S}(nls.meta.x0, nls.meta.nvar, nls.nls_meta.nnzj, nls.nls_meta.nnzh),
32-
nls
41+
nls,
3342
)
3443
end
3544
end
3645

37-
for meth in [:residual!, :jac_structure_residual!, :jac_coord_residual!, :jprod_residual!, :jtprod_residual!, :jac_op_residual!, :hess_structure_residual!, :hess_coord_residual!, :hprod_residual!, :hess_op_residual!]
46+
for meth in [
47+
:residual!,
48+
:jac_structure_residual!,
49+
:jac_coord_residual!,
50+
:jprod_residual!,
51+
:jtprod_residual!,
52+
:jac_op_residual!,
53+
:hess_structure_residual!,
54+
:hess_coord_residual!,
55+
:hprod_residual!,
56+
:hess_op_residual!,
57+
]
3858
@eval begin
3959
$meth(model::NLSVIModel, args...; kwargs...) = $meth(model.nls, args...; kwargs...)
4060
end

src/model/api.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,4 +438,4 @@ function project(model::AbstractVIModel{T, S}, x::AbstractVector{T}) where {T, S
438438
@lencheck model.meta.nvar x
439439
Px = S(undef, model.meta.nvar)
440440
project!(model, x, Px)
441-
end
441+
end

src/projector/proj_nls.jl

+27-10
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ mutable struct NLSProjector{T, S} <: AbstractNLSModel{T, S}
1111
nls_meta::NLSMeta{T, S}
1212
counters::NLSCounters
1313
d::S
14-
function NLSProjector(model::AbstractNLSModel{T, S}, d::S; name = "Projection over $(model.meta.name)") where {T, S}
14+
function NLSProjector(
15+
model::AbstractNLSModel{T, S},
16+
d::S;
17+
name = "Projection over $(model.meta.name)",
18+
) where {T, S}
1519
nvar = length(d)
1620
x0 = d #fill!(S(undef, nvar), zero(T))
1721
meta = NLPModelMeta{T, S}(nvar, x0 = x0, name = name)
18-
nls_meta = NLSMeta{T, S}(
19-
nvar,
20-
nvar,
21-
nnzj = nvar,
22-
nnzh = 0,
23-
)
22+
nls_meta = NLSMeta{T, S}(nvar, nvar, nnzj = nvar, nnzh = 0)
2423
return new{T, S}(model, meta, nls_meta, NLSCounters(), d)
2524
end
2625
end
@@ -36,14 +35,18 @@ function NLPModels.jac_structure_residual!(
3635
cols::AbstractVector{<:Integer},
3736
)
3837
@lencheck model.nls_meta.nnzj rows cols
39-
for i=1:model.meta.nvar
38+
for i = 1:(model.meta.nvar)
4039
rows[i] = i
4140
cols[i] = i
4241
end
4342
return rows, cols
4443
end
4544

46-
function NLPModels.jac_coord_residual!(model::NLSProjector{T, S}, x::AbstractVector, vals::AbstractVector) where {T, S}
45+
function NLPModels.jac_coord_residual!(
46+
model::NLSProjector{T, S},
47+
x::AbstractVector,
48+
vals::AbstractVector,
49+
) where {T, S}
4750
@lencheck model.meta.nvar x
4851
@lencheck model.nls_meta.nnzj vals
4952
increment!(model, :neval_jac_residual)
@@ -89,7 +92,21 @@ function NLPModels.hprod_residual!(::NLSProjector, x, i, v, Hiv)
8992
return Hiv
9093
end
9194

92-
for meth in [:cons!, :jth_congrad!, :jth_sparse_congrad, :jac_structure!, :jac_coord!, :jprod!, :jtprod!, :jth_hess_coord!, :jth_hprod!, :ghjvprod!, :hess_structure!, :hess_coord!, :hprod!]
95+
for meth in [
96+
:cons!,
97+
:jth_congrad!,
98+
:jth_sparse_congrad,
99+
:jac_structure!,
100+
:jac_coord!,
101+
:jprod!,
102+
:jtprod!,
103+
:jth_hess_coord!,
104+
:jth_hprod!,
105+
:ghjvprod!,
106+
:hess_structure!,
107+
:hess_coord!,
108+
:hprod!,
109+
]
93110
premeth = Symbol("NLPModels.", meth)
94111
@eval begin
95112
$premeth(model::NLSProjector, args...; kwargs...) = $meth(model.model, args...; kwargs...)

src/solvers/projectionVI.jl

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
export ProjectionVI
22

3-
function ProjectionVI(
4-
model::AbstractVIModel,
5-
x0::AbstractVector;
6-
rho0 :: Float64 = 0.5,
7-
kwargs...
8-
)
3+
function ProjectionVI(model::AbstractVIModel, x0::AbstractVector; rho0::Float64 = 0.5, kwargs...)
94
stp = GenericStopping(model, x0; kwargs...)
105
return ProjectionVI(stp, rho0 = rho0)
116
end
@@ -17,7 +12,7 @@ function abresidual!(model, xk, rho, Fx) # xk + rho * F(xk)
1712
return Fx
1813
end
1914

20-
function ProjectionVI(stp::AbstractStopping; rho0 :: Float64 = 0.5)
15+
function ProjectionVI(stp::AbstractStopping; rho0::Float64 = 0.5)
2116
xk = stp.current_state.x
2217
xkp = similar(xk)
2318
rho = rho0

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Random.seed!(1234)
1010
xr = rand(2)
1111
@test project(vi, xr) == xr
1212
sol = ProjectionVI(vi, xr)
13-
end
13+
end

0 commit comments

Comments
 (0)