Skip to content

funNystrom++#132

Closed
mmelnich wants to merge 14 commits into
mainfrom
funnystrompp
Closed

funNystrom++#132
mmelnich wants to merge 14 commits into
mainfrom
funnystrompp

Conversation

@mmelnich

Copy link
Copy Markdown
Contributor

WIP

mmelnich added 14 commits May 7, 2026 18:49
Timing:
- NystromEVD: bool timing flag + times[11] (alloc, syrf, matvec, gram,
  potrf, trsm, svd, post_svd, error_est, rest, total); += accumulation
  across adaptive iterations; skip error_est block entirely when
  error_est_p==0 && tol==0 (the fixed-rank FunNystromPP path)
- LanczosFA: bool timing flag + times[5] (matvec, run_lanczos, apply_f,
  rest, total); _t_matvec_us accumulated inside run_lanczos per A-call,
  reset at top of both run_lanczos and call(); workspace_per_thread
  formula written as d*d+4*d-1 to match comment
- FunNystromPP benchmark: nystrom_evd.timing=true, lfa_pp.timing=true;
  per-phase printf breakdown; 32 CSV columns (up from 16)

Bug fixes:
- power_error_est: inner loop variable shadowed outer iter; m=1 column-
  scaling bug from && i!=0 guard; replaced with explicit double loop
- power_error_est: 1.0/0.0 literals -> (T)1/(T)0 for float safety;
  same fix applied throughout NystromEVD::call()
- NystromEVD::call(): int i -> int64_t i in post-SVD eigval loop
- nystrom_pc_data: auto out_state captured int return of call() instead
  of advanced RNGState; fixed to NystromAlg.call(); return state;
- Benchmark printf: nt[9] (nystrom_rest) was dropped from console output
- LFAOp: scalar_t hardcoded as double; use typename SLO_t::scalar_t
- call_all_algs: state param is never modified; changed to const&

Safety:
- Deleted copy ctor/assignment on NystromEVD, LanczosFA (+ explicit
  default ctor), Hutchinson (+ explicit default ctor), FunNystromPP
  to prevent double-free on accidental copy

Test:
- ASSERT_NEAR(err, target, 10*target) -> ASSERT_LT(err, 10*target)
mmelnich added a commit that referenced this pull request May 14, 2026
…entize

Reference-aligned Persson-Kressner port with bit-exact MATLAB↔C++
cross-validation at LAPACK noise floor.

- Phase 5: vendored RandLAPACK::LanczosFA + BlockLanczosFA from
  funnystrompp; util::upsize raw-pointer overload, util::symmetrize.
- Phase 6: SASO sketch (RandBLAS::SparseSkOp) + SkOp-aware first matvec
  via right_spmm through ExplicitSymLinOp overload.
- Phase 7a: Cholesky-fast / eig(YᵀY) HMT §5.1 path in NystromEVD_v2.
  5-rep median speedup vs SVD-pinv fall-back: 2.71×-3.80× across
  k∈{500,1000,1500,2000} at n=2000 (3.80× at k=n=2000, exceeds the
  ~2× claim in funnystrompp PR #132).
- Phase 7a-perf: force_fallback knob + tight t_specrec_ms inner timer.
- Gap port (#1,#2,#3,#5): optional f_zero correction, Phase 2 skip at
  k==n, gesdd(G)→syevd(G) in fall-back, SkOp overload on
  FunNystromPP_v2::call.
- Componentize: NystromEVD_v2 + workspace moved to drivers/rl_nystrom_evd_v2.hh.

12 cross-validation fixtures pass at tol=1e-11 (10/12 at strict
tol=1e-12; 2 misses are alg_poly.t2 ~1.4e-12 long-standing cancellation
noise). v2 unit tests 4/4. Full RandLAPACK suite 309/309.
@mmelnich

Copy link
Copy Markdown
Contributor Author

Reworking this PR in #138

@mmelnich mmelnich closed this May 15, 2026
mmelnich added a commit that referenced this pull request May 25, 2026
…pace, 11-slot timing

Bundle #2 of the v2-polish cycle:

  * Rename rl_nystrom_evd_v2.hh → rl_nystrom_evd.hh; NystromEVD_v2 free
    function → NystromEVD; NystromEVD_v2_workspace → NystromEVD_workspace.
  * Convert workspace from std::vector<T> members to raw T* + int64_t
    pairs grown via util::upsize and freed in a destructor, matching
    PR #132 / rl_revd2.hh patterns. Output params now use
    (T*&, int64_t&) references-to-pointer.
  * Add 11-slot timing vector (alloc / syrf / matvec / gram / potrf
    / trsm / svd / post_svd / error_est=0 / rest / total) with per-
    phase chrono instrumentation; gated on ws.times_enabled. Layout
    mirrors PR #132's NystromEVD for cross-driver tooling parity.
    Slot 8 (error_est) is unused in this fixed-k variant; kept at
    index 8 to preserve the V1 layout.
  * FunNystromPP_v2: U, lambda, Y_2, fAOmega, Y0 promoted from stack
    std::vectors to persistent raw-pointer class members; nystrom_ws
    promoted to a class member so allocations are reused across
    repeated call() invocations. Destructor frees all five buffers.

FunNystromPP_v2's public call signature is unchanged.

Verification:
  * make -j8 + make install -j8 + benchmark rebuild: clean
  * v2 unit tests: 4/4 PASS (FullRankCapture err_t1 = 2.426e-16)
  * 12-fixture cross-validation at tol=1e-12: 10/12 pass, same 2
    alg_poly.t2 cancellation-regime cells as pre-refactor
    (rel_Δ = 4.241e-13, 1.399e-12). est at noise floor across all
    12 fixtures (rel_Δ ∈ [0.0, 3.835e-15]).
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