Skip to content

Support Float32 inputs in merge_pq - #57

Merged
timholy merged 1 commit into
mainfrom
teh/eltypes
Jun 28, 2026
Merged

timholy merged 1 commit into
mainfrom
teh/eltypes

Conversation

@timholy

@timholy timholy commented Jun 28, 2026

Copy link
Copy Markdown
Member

Two coupled fixes for non-Float64 factors:

  • The unit-2-norm check used a hardcoded 1e-12 tolerance, which is below
    eps(Float32). Float32-normalized columns have norm error ~1e-7 and were
    rejected, making merge_pq and nmfmerge unusable for Float32 data. Scale
    the tolerance to the input precision with sqrt(eps(eltype(W))); this only
    loosens the Float64 check.
  • The merge schedule's error field was hardcoded to Float64. Derive its
    element type from the factor eltypes so Float32 inputs yield Float32
    merge errors matching the returned factors.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Two coupled fixes for non-Float64 factors:

- The unit-2-norm check used a hardcoded 1e-12 tolerance, which is below
  eps(Float32). Float32-normalized columns have norm error ~1e-7 and were
  rejected, making merge_pq and nmfmerge unusable for Float32 data. Scale
  the tolerance to the input precision with sqrt(eps(eltype(W))); this only
  loosens the Float64 check.
- The merge schedule's error field was hardcoded to Float64. Derive its
  element type from the factor eltypes so Float32 inputs yield Float32
  merge errors matching the returned factors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@timholy
timholy merged commit 3419835 into main Jun 28, 2026
2 checks passed
@timholy
timholy deleted the teh/eltypes branch June 28, 2026 20:21
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