@@ -191,3 +191,55 @@ mutable struct expfit_struct
191191 eqn:: String
192192 title:: String
193193end
194+
195+
196+ # define structs for extension solvers
197+ function solve_regularization (K, g, α, solver:: regularization_solver )
198+ error (" The package needed for $(typeof (solver)) is not loaded." )
199+ end
200+
201+ export nnls
202+ """
203+ nnls(; L, algorithm)
204+ Non-negative least squares method for regularization,
205+ implemented using the `NonNegLeastSquares` package extension.
206+ Decent speed for small, 1D regularizations, but very slow for larger, 2D problems.
207+ It can be used as a "solver" for invert function.
208+
209+ - `L` determines the tikhonov matrix.\
210+ Can be either a matrix or an integer `n`. The latter will create a finite difference matrix\
211+ of order `n`, which means that the penalty term will be the `n`'th derivative of the distribution.\
212+ Defaults to `0`, where `L` becomes the Identity matrix.
213+ - `algorithm` is one of:
214+ * `:nnls`
215+ * `:fnnls`
216+ * `:pivot`
217+ """
218+ struct nnls <: regularization_solver
219+ L:: Union{Int, AbstractMatrix}
220+ algorithm:: Symbol
221+ end
222+ nnls (;L= 0 , algorithm= :nnls ) = nnls (L, algorithm)
223+
224+
225+ export jump_nnls
226+ """
227+ jump_nnls(L, solver)
228+ Jump non-negative least squares method for tikhonov (L2) regularization,
229+ implemented using the JuMP package extension.
230+ All around effective, but can be slow for large problems, such as 2D inversions,
231+ unless a powerful solver like gurobi is used.
232+
233+ - `L` determines the tikhonov matrix.\
234+ Can be either a matrix or an integer `n`. The latter will create a finite difference matrix\
235+ of order `n`, which means that the penalty term will be the `n`'th derivative of the distribution.\
236+ Defaults to `0`, where `L` becomes the Identity matrix.
237+ - `solver` is passed directly into JuMP, see its documentation for available options.
238+
239+ This one is still experimental and not well-tested,
240+ please submit an issue if you encounter any difficulties.
241+ """
242+ struct jump_nnls <: regularization_solver
243+ order:: Int
244+ solver:: Symbol
245+ end
0 commit comments