Skip to content

Generic-indexing declarations, test coverage, docstrings, and documentation#31

Merged
timholy merged 4 commits into
mainfrom
teh/freshen2
Jun 12, 2026
Merged

Generic-indexing declarations, test coverage, docstrings, and documentation#31
timholy merged 4 commits into
mainfrom
teh/freshen2

Conversation

@timholy

@timholy timholy commented Jun 12, 2026

Copy link
Copy Markdown
Member

This bundles the remaining substantive maintenance work ahead of a formatting-only PR.

Generic indexing

The pipeline runs through svd, nndsvd, nnmf, and sparse, all of which assume 1-based indexing, so the public entry points (gsvdnmf, gsvdrecover, and the truncating/joint_nnls strategies) now declare that assumption with Base.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 than size(W0, 2) previously made the 1:n factor slices succeed on the wrong columns, silently returning wrong factors. A new "generic axes" testset locks in both the eager rejection of OffsetArray inputs and equality of results for view-wrapped inputs.

Test coverage

New testsets cover the integer-n2 convenience methods gsvdnmf(X, W, H, n2::Integer) (which compute tsvd(X, n2) internally) and the alg = :multmse branch, which floors the augmented factors at truncmult so 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 (not NMF.NMFResult), and ncomponents accepts any Pair{<:Integer,<:Integer}. The docstrings now document the n1 < n2 ≤ 2n1 constraint, the integer-for-f convenience form, and the duck-typed contract for X in gsvdrecover; the strategy docstrings cross-reference each other with cost/requirement tradeoffs. A module docstring is added. gsvdnmf (both forms) and gsvdrecover gain jldoctest examples, exercised in CI via a new Documenter.doctest testset.

Citation and README

The paper is now published as Guo & Holy, iScience 29(3):114708 (2026), doi:10.1016/j.isci.2026.114708. CITATION.cff titles the software itself and carries the article in a preferred-citation block (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 finite maxiter and checks converged — 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

timholy and others added 4 commits June 12, 2026 13:45
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>
@timholy timholy merged commit 0446247 into main Jun 12, 2026
2 checks passed
@timholy timholy deleted the teh/freshen2 branch June 12, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant