diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8727455..ea176d3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,14 +54,13 @@ jobs: julia --project=docs -e ' using Pkg Pkg.develop(PackageSpec(path=pwd())) - Pkg.add("LinearOperatorCollection") - Pkg.add("Wavelets") Pkg.instantiate()' - run: | julia --project=docs -e ' - using Documenter: doctest + using Documenter: DocMeta, doctest using RegularizedLeastSquares - doctest(RegularizedLeastSquares)' # change MYPACKAGE to the name of your package + DocMeta.setdocmeta!(RegularizedLeastSquares, :DocTestSetup, :(using RegularizedLeastSquares); recursive=true) + doctest(RegularizedLeastSquares)' - run: julia --project=docs docs/make.jl env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/Project.toml b/docs/Project.toml index 531318e4..755ce4d3 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,5 +1,10 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +LinearOperatorCollection = "a4a2c56f-fead-462a-a3ab-85921a5f2575" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +RegularizedLeastSquares = "1e9c538a-f78c-5de5-8ffb-0b6dbe892d23" +UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" +Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a" [compat] -Documenter = "0.25" +Documenter = "1.0, 1.1, 1.2" diff --git a/docs/make.jl b/docs/make.jl index fab444f0..e592dd56 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,10 +1,15 @@ using Documenter, RegularizedLeastSquares, LinearOperatorCollection, Wavelets makedocs( - format = Documenter.HTML(prettyurls = false), + format = Documenter.HTML(; + prettyurls=get(ENV, "CI", "false") == "true", + canonical="https://github.com/JuliaImageRecon/RegularizedLeastSquares.jl", + assets=String[], + ), + repo="https://github.com/JuliaImageRecon/RegularizedLeastSquares.jl/blob/{commit}{path}#{line}", modules = [RegularizedLeastSquares], sitename = "RegularizedLeastSquares.jl", - authors = "Tobias Knopp, Mirco Grosser, Martin Möddel, Niklas Hackelberg", + authors = "Tobias Knopp, Mirco Grosser, Martin Möddel, Niklas Hackelberg, Andrew Mao, Jakob Assländer", pages = [ "Home" => "index.md", "Getting Started" => "gettingStarted.md", @@ -15,7 +20,8 @@ makedocs( ], pagesonly = true, - checkdocs = :none + checkdocs = :none, + doctest = true ) -deploydocs(repo = "github.com/JuliaImageRecon/RegularizedLeastSquares.jl.git") +deploydocs(repo = "github.com/JuliaImageRecon/RegularizedLeastSquares.jl.git", push_preview = true) \ No newline at end of file diff --git a/docs/src/API/regularization.md b/docs/src/API/regularization.md index 49bf2e23..c18e147a 100644 --- a/docs/src/API/regularization.md +++ b/docs/src/API/regularization.md @@ -1,17 +1,7 @@ -# API +# API for Regularizers This page contains documentation of the public API of the RegularizedLeastSquares. In the Julia REPL one can access this documentation by entering the help mode with `?` -## General -```@docs -RegularizedLeastSquares.prox!(::AbstractParameterizedRegularization, ::AbstractArray) -RegularizedLeastSquares.norm(::AbstractParameterizedRegularization, ::AbstractArray) -RegularizedLeastSquares.λ(::AbstractParameterizedRegularization) -RegularizedLeastSquares.prox!(::Type{<:AbstractParameterizedRegularization}, ::Any, ::Any) -RegularizedLeastSquares.norm(::Type{<:AbstractParameterizedRegularization}, ::Any, ::Any) -``` - -## Parameterized Regularization ```@docs RegularizedLeastSquares.L1Regularization RegularizedLeastSquares.L2Regularization @@ -51,4 +41,13 @@ RegularizedLeastSquares.MaskedRegularization RegularizedLeastSquares.TransformedRegularization RegularizedLeastSquares.ConstraintTransformedRegularization RegularizedLeastSquares.PlugAndPlayRegularization +``` + +## Miscellaneous Functions +```@docs +RegularizedLeastSquares.prox!(::AbstractParameterizedRegularization, ::AbstractArray) +RegularizedLeastSquares.prox!(::Type{<:AbstractParameterizedRegularization}, ::Any, ::Any) +RegularizedLeastSquares.norm(::AbstractParameterizedRegularization, ::AbstractArray) +RegularizedLeastSquares.λ(::AbstractParameterizedRegularization) +RegularizedLeastSquares.norm(::Type{<:AbstractParameterizedRegularization}, ::Any, ::Any) ``` \ No newline at end of file diff --git a/docs/src/API/solvers.md b/docs/src/API/solvers.md index b7bb7bab..fb6440c2 100644 --- a/docs/src/API/solvers.md +++ b/docs/src/API/solvers.md @@ -1,57 +1,52 @@ -# API +# API for Solvers This page contains documentation of the public API of the RegularizedLeastSquares. In the Julia REPL one can access this documentation by entering the help mode with `?` -## General +## solve ```@docs -RegularizedLeastSquares.linearSolverList -RegularizedLeastSquares.createLinearSolver RegularizedLeastSquares.solve(::AbstractLinearSolver, ::Any) -RegularizedLeastSquares.SolverInfo -RegularizedLeastSquares.applicableSolverList -RegularizedLeastSquares.isapplicable ``` ## ADMM ```@docs RegularizedLeastSquares.ADMM -RegularizedLeastSquares.solve(::ADMM, ::Any) ``` ## CGNR ```@docs RegularizedLeastSquares.CGNR -RegularizedLeastSquares.solve(::CGNR, ::Any) ``` ## Kaczmarz ```@docs RegularizedLeastSquares.Kaczmarz -RegularizedLeastSquares.solve(::Kaczmarz, ::Vector{Any}) ``` ## FISTA ```@docs RegularizedLeastSquares.FISTA -RegularizedLeastSquares.solve(::FISTA, ::Any) ``` ## OptISTA ```@docs RegularizedLeastSquares.OptISTA -RegularizedLeastSquares.solve(::OptISTA, ::Any) ``` ## POGM ```@docs RegularizedLeastSquares.POGM -RegularizedLeastSquares.solve(::POGM, ::Any) ``` ## SplitBregman ```@docs RegularizedLeastSquares.SplitBregman -RegularizedLeastSquares.solve(::SplitBregman, ::Any) ``` -## Direct \ No newline at end of file +## Miscellaneous Functions +```@docs +RegularizedLeastSquares.linearSolverList +RegularizedLeastSquares.createLinearSolver +RegularizedLeastSquares.SolverInfo +RegularizedLeastSquares.applicableSolverList +RegularizedLeastSquares.isapplicable +``` \ No newline at end of file diff --git a/docs/src/examples/ex_cs.jl b/docs/src/examples/ex_cs.jl deleted file mode 100644 index 0d70eab1..00000000 --- a/docs/src/examples/ex_cs.jl +++ /dev/null @@ -1,21 +0,0 @@ -using RegularizedLeastSquares, Images, PyPlot, Random - -# image -N = 256 -I = shepp_logan(N) - -# sampling operator -idx = sort( shuffle( collect(1:N^2) )[1:div(N^2,2)] ) -A = SamplingOp(idx,(N,N)) - -# generate undersampled data -y = A*vec(I) - -# regularizer -reg = Regularization("TV", 0.01; shape=(N,N)) - -# solver -solver = createLinearSolver("admm",A; reg=reg, ρ=0.1, iterations=20) - -Ireco = solve(solver,y) -Ireco = reshape(Ireco,N,N) diff --git a/src/Regularization/ScaledRegularization.jl b/src/Regularization/ScaledRegularization.jl index 59c53bcf..eca47e8f 100644 --- a/src/Regularization/ScaledRegularization.jl +++ b/src/Regularization/ScaledRegularization.jl @@ -2,23 +2,23 @@ export AbstractScaledRegularization """ AbstractScaledRegularization -Nested regularization term that applies a `factor` to the regularization parameter `λ` of its `inner` term. +Nested regularization term that applies a `scalefactor` to the regularization parameter `λ` of its `inner` term. -See also [`factor`](@ref), [`λ`](@ref), [`innerreg`](@ref). +See also [`scalefactor`](@ref), [`λ`](@ref), [`innerreg`](@ref). """ abstract type AbstractScaledRegularization{T, S<:AbstractParameterizedRegularization{T}} <: AbstractNestedRegularization{S} end """ - scalefactor(reg::AbstractScaledRegularization) + scalescalefactor(reg::AbstractScaledRegularization) -return the scaling `factor` for `λ` +return the scaling `scalefactor` for `λ` """ -scalefactor(::R) where R <: AbstractScaledRegularization = error("Scaled regularization term $R must implement factor") +scalefactor(::R) where R <: AbstractScaledRegularization = error("Scaled regularization term $R must implement scalefactor") """ λ(reg::AbstractScaledRegularization) return `λ` of `inner` regularization term scaled by `scalefactor(reg)`. -See also [`factor`](@ref), [`innerreg`](@ref). +See also [`scalefactor`](@ref), [`innerreg`](@ref). """ λ(reg::AbstractScaledRegularization) = λ(innerreg(reg)) * scalefactor(reg) @@ -36,7 +36,7 @@ export FixedParameterRegularization """ FixedParameterRegularization -Nested regularization term that discards any `λ` passed to it and instead uses `λ` from its inner regularization term. This can be used to selectively disallow normalization. +Nested regularization term that discards any `λ` passed to it and instead uses `λ` from its inner regularization term. This can be used to selectively disallow normalization. """ struct FixedParameterRegularization{T, S, R} <: AbstractScaledRegularization{T, S} reg::R @@ -61,16 +61,16 @@ innerreg(reg::AutoScaledRegularization) = reg.reg # A bit hacky: Factor can only be computed once x is seen, therefore hide factor in λ and silently add it in prox!/norm calls scalefactor(reg::AutoScaledRegularization) = isnothing(reg.factor) ? 1.0 : reg.factor function prox!(reg::AutoScaledRegularization, x, λ) - if isnothing(reg.factor) - initFactor!(reg, x) + if isnothing(reg.factor) + initFactor!(reg, x) return prox!(reg.reg, x, λ * reg.factor) else return prox!(reg.reg, x, λ) end end function norm(reg::AutoScaledRegularization, x, λ) - if isnothing(reg.factor) - initFactor!(reg, x) + if isnothing(reg.factor) + initFactor!(reg, x) return norm(reg.reg, x, λ * reg.factor) else return norm(reg.reg, x, λ)