Skip to content

⚡ Bolt: Remove redundant matrix inversions in vuongtest.R#8

Open
seonghobae wants to merge 1 commit into
masterfrom
bolt/perf-matrix-inversions-17702471422863492329
Open

⚡ Bolt: Remove redundant matrix inversions in vuongtest.R#8
seonghobae wants to merge 1 commit into
masterfrom
bolt/perf-matrix-inversions-17702471422863492329

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What: Replaced the return of the inverse matrix A with the original variance-covariance matrix tmpvc (named Ainv) in calcAB(). Updated calcLambda() to use Ainv directly instead of doing chol2inv(chol(AB1$A)) and chol2inv(chol(AB2$A)).
🎯 Why: In calcAB(), we calculated A <- chol2inv(chol(tmpvc)). In calcLambda(), we were doing chol2inv(chol(AB1$A)), which mathematically is just calculating the inverse of the inverse, bringing us back to tmpvc. This caused unnecessary O(n^3) matrix inversions, which are highly expensive for large matrices.
📊 Impact: Reduces execution time for vuongtest() by eliminating redundant matrix inversions, especially noticeable when dealing with large model variance-covariance matrices. Removes unnecessary numerical instability.
🔬 Measurement: Benchmark vuongtest() with large lavaan or mirt models; execution time and cpu load should drop significantly for the variance test calculations.


PR created automatically by Jules for task 17702471422863492329 started by @seonghobae

Replaced `chol2inv(chol(...))` of an already inverted matrix by passing the non-inverted matrix forward, saving computation time.
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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