Generic-indexing declarations, test coverage, docstrings, and documentation#31
Merged
Conversation
The pipeline runs through svd, nndsvd, nnmf, and sparse, all of which assume 1-based indexing. Without a declaration, offset-axes inputs fail deep inside LinearAlgebra — or worse: an offset SVD wider than size(W0, 2) makes the 1:n factor slices in gsvdrecover succeed on the wrong columns, silently returning wrong factors. Add Base.require_one_based_indexing at gsvdnmf, gsvdrecover, and the two bundled strategies (X checked only when it is an AbstractArray, preserving the duck-typed factored-matrix contract). Tests assert that offset inputs error cleanly on every public path and that view-wrapped inputs reproduce plain-input results. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These were the only uncovered lines in src/: the convenience methods that compute tsvd(X, n2) internally, and the flooring of the augmented factors to truncmult that lets multiplicative updates (which cannot move entries off zero) polish them. src/ line coverage is now 100%. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a module docstring, restructure all public docstrings to standard
Julia conventions (prose "Return ..." sentence, bulleted arguments,
consistent keyword style), and fix errors: the return type is
NMF.Result (not NMF.NMFResult), and ncomponents accepts any
Pair{<:Integer,<:Integer}. Document the n1 < n2 <= 2n1 constraint, the
integer-for-f convenience form, and the duck-typed contract for X in
gsvdrecover. The strategy docstrings now cross-reference each other
with cost/requirement tradeoffs.
Add jldoctest examples to gsvdnmf (both forms) and gsvdrecover, and
run them in the test suite via Documenter.doctest.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The paper is published as Guo & Holy, iScience 29(3):114708 (2026), doi:10.1016/j.isci.2026.114708. CITATION.cff now titles the software itself and carries the article in a preferred-citation block (arXiv preprint kept as an identifier); README cites the article directly. README: add JuliaHub version badge and an installation section, make the demo runnable from an installed package via pkgdir, and replace the hand-copied "Functions" section with a brief API overview that defers to the doctested docstrings. The demo now uses a finite maxiter and checks `converged`, demonstrating that NMF stops at the tolerance rather than the iteration cap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This bundles the remaining substantive maintenance work ahead of a formatting-only PR.
Generic indexing
The pipeline runs through
svd,nndsvd,nnmf, andsparse, all of which assume 1-based indexing, so the public entry points (gsvdnmf,gsvdrecover, and thetruncating/joint_nnlsstrategies) now declare that assumption withBase.require_one_based_indexing. Offset-axes inputs fail at entry with a clear error instead of deep inside LinearAlgebra — or worse: an offset SVD wider thansize(W0, 2)previously made the1:nfactor slices succeed on the wrong columns, silently returning wrong factors. A new "generic axes" testset locks in both the eager rejection ofOffsetArrayinputs and equality of results forview-wrapped inputs.Test coverage
New testsets cover the integer-
n2convenience methodsgsvdnmf(X, W, H, n2::Integer)(which computetsvd(X, n2)internally) and thealg = :multmsebranch, which floors the augmented factors attruncmultso multiplicative updates can polish them.Docstrings
All public docstrings are rewritten to standard Julia conventions (prose "Return ..." sentence, bulleted arguments, consistent keyword style), and two errors are fixed: the return type is
NMF.Result(notNMF.NMFResult), andncomponentsaccepts anyPair{<:Integer,<:Integer}. The docstrings now document then1 < n2 ≤ 2n1constraint, the integer-for-fconvenience form, and the duck-typed contract forXingsvdrecover; the strategy docstrings cross-reference each other with cost/requirement tradeoffs. A module docstring is added.gsvdnmf(both forms) andgsvdrecovergainjldoctestexamples, exercised in CI via a newDocumenter.doctesttestset.Citation and README
The paper is now published as Guo & Holy, iScience 29(3):114708 (2026), doi:10.1016/j.isci.2026.114708.
CITATION.cfftitles the software itself and carries the article in apreferred-citationblock (validated against the CFF 1.2.0 schema; the arXiv preprint remains as an identifier), and the README cites the article directly.The README also gains a JuliaHub version badge and an installation section. Its demo is now runnable from an installed package (via
pkgdir) rather than only from a repo clone, uses a finitemaxiterand checksconverged— demonstrating that NMF stops at the tolerance, not the iteration cap — and its outputs were re-verified against current package versions. The hand-copied "Functions" section, which had drifted from the source, is replaced by a brief API overview that defers to the doctested docstrings.🤖 Generated with Claude Code