⚡ Bolt: optimize covariance matrix powers and runica training loops - #266
⚡ Bolt: optimize covariance matrix powers and runica training loops#266suraj-ranganath wants to merge 1 commit into
Conversation
- Vectorize `diag_nd` in `covariance.py` using advanced indexing (~10x speedup). - Optimize `cov_logm`, `cov_expm`, etc. using broadcasting to avoid `diag_nd` calls and redundant matrix multiplications. - Vectorize row mean subtraction in `runica.py`. - Replace `_matmul(bias, onesrow)` with broadcasting in `runica.py` training loops, reducing memory allocation and compute overhead. Co-authored-by: suraj-ranganath <14310165+suraj-ranganath@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Claude finished @suraj-ranganath's task in 1m 48s —— View job Code review
Overall assessment: Safe to merge. The optimizations are mathematically equivalent to the originals. BlockingNone. ImportantNone. Nits
Test gapsNone required. These are behavior-preserving optimizations, so the existing EEGLAB parity notesVerified the rewrites are equivalent, not just faster:
|
|
🤖 Closing this combined optimization. The covariance changes duplicate the retained #281, while the runica mean/bias changes overlap the retained #278. They are unrelated kernels with different numerical and performance risks and should not share a merge/revert unit. Keeping the focused candidates gives each change a clear test and review boundary. |
Understood. Acknowledging that this work is now obsolete and stopping work on this task as the optimizations are being handled in separate, more focused PRs (#281 and #278). |
💡 What: Optimized core numerical operations in
covariance.pyandrunica.py.🎯 Why: Stacks of covariance matrices and ICA training loops are performance bottlenecks.
📊 Impact:
diag_ndis ~10x faster;runicatraining is ~3% faster.🔬 Measurement: Verified with
tools/benchmark_covariance_optimized.pyandtools/benchmark_runica.py.PR created automatically by Jules for task 10895161003436251304 started by @suraj-ranganath