Skip to content

Commit

Permalink
Enhance docstring for nonneg_lsq (#40)
Browse files Browse the repository at this point in the history
- document default value of `alg`
- describe `variant` more completely
- document `use_parallel`
- improve formatting
  • Loading branch information
timholy authored Jul 17, 2024
1 parent 4a9cf64 commit d116b2a
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/interface.jl
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
"""
**x = nonneg_lsq(A, B; ...)**
**x = nonneg_lsq(A'*A, A'*B; gram=true,...)**
X = nonneg_lsq(A, B; gram=false, alg=:pivot, variant=:none, use_parallel=true, kwargs...)
X = nonneg_lsq(A'*A, A'*B; gram=true, ...)
Computes the (k-by-n) matrix X with that minimizes vecnorm(A*X - B) subject to
X >= 0, where A is an (m-by-k) matrix and B is a (m-by-n) matrix.
Computes the matrix `X` that minimizes `vecnorm(A*X - B)` subject to
`X .>= 0`, where `A` is an (m-by-k) matrix and `B` is a (m-by-n) matrix.
Alternatively one can supply a vector `b`.
Optional arguments
------------------
**alg:** a symbol specifying the algorithm to be used
`alg`: a symbol specifying the algorithm to be used
:pivot - Block-pivoting active-set-like method (Kim & Park, 2011)
:fnnls - Fast active-set method (Bro & De Jong, 1997)
:nnls - Classic active-set method (Lawson & Hanson, 1974)
:admm - Alternating Direction Method of Multipliers (e.g., Boyd et al., 2011)
- `:pivot`: Block-pivoting active-set-like method (Kim & Park, 2011)
- `:fnnls`: Fast active-set method (Bro & De Jong, 1997)
- `:nnls`: Classic active-set method (Lawson & Hanson, 1974)
- `:admm`: Alternating Direction Method of Multipliers (e.g., Boyd et al., 2011)
**variant:** a symbol specifying the variant, if applicable,
`variant`: a symbol specifying the variant (applicable only to `alg=:pivot`, with potential values `:comb` or `:cache`)
**gram:** a boolean indicating whether inputs A,B are Gram matrices A'*A,A'*B or data matrices A,B.
`gram`: a boolean that should be set to `true` if one is supplying Gram matrices `A'*A`,`A'*B` instead of the data matrices `A`,`B`.
**tol:** tolerance for nonnegativity constraints
`tol:` tolerance for nonnegativity constraints
**max_iter:** maximum number of iterations before function gives up
`max_iter:` maximum number of iterations before function gives up
`use_parallel`: use threading if `B` has multiple columns and `Threads.nthreads() > 1`.
"""
function nonneg_lsq(
A,
Expand Down

4 comments on commit d116b2a

@timholy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Changing package repo URL not allowed, please submit a pull request with the URL change to the target registry and retry.

@timholy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/111708

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.1 -m "<description of version>" d116b2a18fb1ede8ed70c0b7f32a9cd45a161132
git push origin v0.4.1

Please sign in to comment.