Skip to content

Commit

Permalink
Merge branch 'nestedRegTerms' of github.com:tknopp/RegularizedLeastSq…
Browse files Browse the repository at this point in the history
…uares.jl into nestedRegTerms
  • Loading branch information
nHackel committed Aug 30, 2023
2 parents ff08ed0 + f48f3d0 commit a015709
Show file tree
Hide file tree
Showing 23 changed files with 150 additions and 1,095 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
- 'nightly'
os:
- ubuntu-latest
arch:
Expand Down
22 changes: 17 additions & 5 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
The RegularizedLeastSquares.jl package is licensed under the MIT "Expat" License:
MIT License

Copyright (c) 2017: Tobias Knopp.
Copyright (c) 2023 Tobias Knopp <tobias.knopp@tuhh.de> and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 6 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
LinearOperatorCollection = "a4a2c56f-fead-462a-a3ab-85921a5f2575"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"


[compat]
FLoops = "0.2"
IterativeSolvers = "0.9"
ProgressMeter = "1.2"
LinearOperators = "2.5"
LinearOperators = "2.3.3"
LinearOperatorCollection = "1.0"
StatsBase = "0.33"
VectorizationBase = "0.19, 0.21"
julia = "1.6"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# RegularizedLeastSquares

[![Build status](https://github.com/tknopp/RegularizedLeastSquares.jl/workflows/CI/badge.svg)](https://github.com/tknopp/RegularizedLeastSquares.jl/actions)
[![Build status](https://github.com/JuliaImageRecon/RegularizedLeastSquares.jl/workflows/CI/badge.svg)](https://github.com/JuliaImageRecon/RegularizedLeastSquares.jl/actions)

[![codecov.io](http://codecov.io/github/tknopp/RegularizedLeastSquares.jl/coverage.svg?branch=master)](http://codecov.io/github/tknopp/RegularizedLeastSquares.jl?branch=master)
[![codecov.io](http://codecov.io/github/JuliaImageRecon/RegularizedLeastSquares.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaImageRecon/RegularizedLeastSquares.jl?branch=master)


# Documentation

Read the documentation here:

[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://tknopp.github.io/RegularizedLeastSquares.jl/latest)
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaImageRecon.github.io/RegularizedLeastSquares.jl/latest)

# Community Standards

Expand Down
2 changes: 1 addition & 1 deletion docs/src/regularization.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ So far, the following common regularizers are implemented:
* Positivity constrained ("Positive")
* Projection onto a convex set ("Proj")

To build any of the implemted regularizers, one can use the methods `Regularization(name::String, λ::AbstractFloat; kargs...)` with the corresponding name (in brackets in the list above). For example, an $l_1$-regularizer can be build with
To build any of the implemented regularizers, one can use the methods `Regularization(name::String, λ::AbstractFloat; kargs...)` with the corresponding name (in brackets in the list above). For example, an $l_1$-regularizer can be build with
```julia
shape = (256,256) # size of the underlying Array
λ = 1.e-3 # regularization parameter
Expand Down
5 changes: 2 additions & 3 deletions docs/src/solvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

## Implemented Solvers
So far, RegularizedLeastSquares.jl provides implementations for the following solvers:
* Kaczrmarz algorithm ("kaczmarz")
* Kaczmarz algorithm ("Kaczmarz")
* CGNR ("cgnr")
* Dax algorithm (with Kaczmarz) for unconstrained problems ("daxkaczmarz")
* Dax algorithm for constrained problems ("daxconstrained")
* Solver for the Fused Lasso problem ("fusedlasso")
* Fast Iterative Shrinkage Thresholding Algorithm ("fista")
* Alternating Direction of Multipliers Method ("admm")
* Split Bregman method for constrained inverse Problems ("splitBregman")
Expand All @@ -19,7 +18,7 @@ To create a solver, one can invoke the method `createLinearSolver` as in
solver = createLinearSolver("admm",A; reg=reg, ρ=0.1, iterations=20)
```
Here `A` denotes the system matrix and reg is either a `Regularization` or a`Vector{Regularization}`. All further solver parameters can be passed as keyword arguments. To make things more compact, it can be usefull to collect all parameters
in a `Dict{Symnbol,Any}`. In this way, the code snippet above can be written as
in a `Dict{Symbol,Any}`. In this way, the code snippet above can be written as
```julia
params=Dict{Symbol,Any}()
params[:reg] = reg
Expand Down
4 changes: 2 additions & 2 deletions src/ADMM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ creates an `ADMM` object for the system matrix `A`.
* (`relTol::Real=eps()`) - rel tolerance for stopping criterion
* (`tolInner::Real=1.e-5`) - rel tolerance for CG stopping criterion
"""
function ADMM(A::matT, x::Vector{T}=zeros(eltype(A),size(A,2)); reg=L1Regularization(λ[1])
, λ=[0.0]
function ADMM(A::matT, x::Vector{T}=zeros(eltype(A),size(A,2)); λ=[0.0]
, reg=L1Regularization(λ[1])
, regTrafo=nothing
, AᴴA::opT=nothing
, precon=Identity()
Expand Down
4 changes: 2 additions & 2 deletions src/DAXConstrained.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function lentcensormin!(x::Vector{T},y::Vector{T}) where {T<:Real}
end
end

"""This funtion saves the denominators to compute αl in denom and the rowindices,
"""This function saves the denominators to compute αl in denom and the rowindices,
which lead to an update of cl in rowindex."""
function initkaczmarzconstraineddax(S::AbstractMatrix::Number,weights::Vector)
length(weights)==size(S,1) ? nothing : error("number of weights must equal number of equations")
Expand All @@ -214,7 +214,7 @@ function initkaczmarzconstraineddax(S::AbstractMatrix,ɛ::Number,weights::Vector
end

"""
This funtion saves the denominators to compute αl in denom and the rowindices,
This function saves the denominators to compute αl in denom and the rowindices,
which lead to an update of cl in rowindex.
"""
function initkaczmarzconstraineddaxfft(S::AbstractMatrix::Number,weights::Vector)
Expand Down
8 changes: 4 additions & 4 deletions src/DAXKaczmarz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ mutable struct DaxKaczmarz{matT,T,U} <: AbstractLinearSolver
iterationsInner::Int64
end

"""This function solves a unconstrained linear least squaares problem using an algorithm proposed in [1] combined with a randomized version of kaczmarz [2].
Returns an approximate solution to the linear leaast squares problem Sᵀx = u.
"""This function solves a unconstrained linear least squares problem using an algorithm proposed in [1] combined with a randomized version of kaczmarz [2].
Returns an approximate solution to the linear least squares problem Sᵀx = u.
[1] Dax, A. On Row Relaxation Methods for Large Constrained Least Squares Problems. SIAM J. Sci. Comput. 14, 570–584 (1993).
[2] Strohmer, T. & Vershynin, R. A Randomized Kaczmarz Algorithm with Exponential Convergence. J. Fourier Anal. Appl. 15, 262–278 (2008).
Expand Down Expand Up @@ -71,7 +71,7 @@ function DaxKaczmarz(S, b=nothing; λ::Real=0.0
push!(reg, RealRegularization())
end
if !isempty(reg) && !isnothing(sparseTrafo)
reg = map(r -> SparseRegularization(r, sparseTrafo), reg)
reg = map(r -> TransformedRegularization(r, sparseTrafo), reg)
end
return DaxKaczmarz(S,u,reg, Float64(λ), denom,rowindex,sumrowweights,zk,bk,xl,yl,εw,τl,αl
,T.(weights) ,iterations,iterationsInner)
Expand Down Expand Up @@ -162,7 +162,7 @@ end

@inline done(solver::DaxKaczmarz,iteration::Int) = iteration>=solver.iterations

"""This funtion saves the denominators to compute αl in denom and the rowindices,
"""This function saves the denominators to compute αl in denom and the rowindices,
which lead to an update of cl in rowindex.
"""
function initkaczmarzdax(S::AbstractMatrix, ɛ, weights::Vector)
Expand Down
4 changes: 2 additions & 2 deletions src/Direct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export pseudoinverse, directSolver, PseudoInverse, DirectSolver

### Direct Solver ###

mutable struct DirectSolver <: AbstractLinearSolver
mutable struct DirectSolver #<: AbstractLinearSolver
A
params
end
Expand Down Expand Up @@ -46,7 +46,7 @@ end

### Pseudoinverse ###

mutable struct PseudoInverse <: AbstractLinearSolver
mutable struct PseudoInverse #<: AbstractLinearSolver
A
params
end
Expand Down
Loading

0 comments on commit a015709

Please sign in to comment.